Blame tests/p_initscripts/initscripts_service_status.sh

Athmane Madjoudj df052c
#!/bin/bash
Athmane Madjoudj df052c
# Author: Athmane Madjoudj <athmanem@gmail.com>
Athmane Madjoudj df052c
40b4c8
if [ "$CONTAINERTEST" -eq "1" ]; then
40b4c8
    t_Log "Running in container -> SKIP"
40b4c8
    exit 0
40b4c8
fi
40b4c8
Athmane Madjoudj df052c
t_Log "Running $0 - check if service cmd can get service status"
Athmane Madjoudj df052c
Carlos Rodriguez-Fernandez 8cacc7
output_file=$(mktemp)
Carlos Rodriguez-Fernandez 8cacc7
trap "rm -f ${output_file}" EXIT
Athmane Madjoudj df052c
Carlos Rodriguez-Fernandez 8cacc7
# auditd is used as example because it's standard with minimal install
Carlos Rodriguez-Fernandez 8cacc7
if ! service auditd status > ${output_file} 2>&1; then
Carlos Rodriguez-Fernandez 8cacc7
  cat ${output_file}
Carlos Rodriguez-Fernandez 8cacc7
  t_CheckExitStatus 1
Carlos Rodriguez-Fernandez 8cacc7
fi
Athmane Madjoudj df052c
Carlos Rodriguez-Fernandez 8cacc7
t_CheckExitStatus 0