Fix systemd
This commit is contained in:
parent
986f3e2fc2
commit
0ad9690aa9
1 changed files with 5 additions and 2 deletions
|
@ -79,18 +79,21 @@ function checkService() {
|
|||
if [ "$(id -u)" != "0" ]; then
|
||||
local USER_COMMAND="systemctl --user is-active --quiet $SERVICE";
|
||||
RESULT=$($USER_COMMAND);
|
||||
if [ -z "$RESULT" ]; then
|
||||
RESULT=0;
|
||||
fi
|
||||
else
|
||||
local ROOT_COMMAND="systemctl is-active --quiet $SERVICE";
|
||||
local USER_COMMAND="systemctl --user is-active --quiet $SERVICE";
|
||||
local RESULT_ROOT_COMMAND=$($ROOT_COMMAND);
|
||||
local RESULT_USER_COMMAND=$($USER_COMMAND);
|
||||
|
||||
if [ "$RESULT_ROOT_COMMAND" ] || [ "$RESULT_USER_COMMAND" ]; then
|
||||
if [ -z "$RESULT_ROOT_COMMAND" ] || [ -z "$RESULT_USER_COMMAND" ]; then
|
||||
RESULT=0;
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! "$RESULT"; then
|
||||
if [ "$RESULT" -gt 0 ]; then
|
||||
local SUBJECT="[systemd $SYSTEMD_CHECK_HOSTNAME for $SYSTEMD_CHECK_USER] CRITICAL $SERVICE";
|
||||
echo "-> $SUBJECT: $MESSAGE";
|
||||
|
||||
|
|
Loading…
Reference in a new issue