Fix systemd
This commit is contained in:
parent
0ad9690aa9
commit
fde200fec8
1 changed files with 6 additions and 9 deletions
|
@ -74,21 +74,18 @@ done < "$SYSTEMD_CHECK_LIST_FILE"
|
|||
function checkService() {
|
||||
local SERVICE=$1;
|
||||
local MESSAGE="$SERVICE is not running for user $SYSTEMD_CHECK_USER";
|
||||
|
||||
local ROOT_COMMAND="systemctl is-active --quiet $SERVICE";
|
||||
local USER_COMMAND="systemctl --user is-active --quiet $SERVICE";
|
||||
|
||||
local RESULT=1;
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
local USER_COMMAND="systemctl --user is-active --quiet $SERVICE";
|
||||
RESULT=$($USER_COMMAND);
|
||||
if [ -z "$RESULT" ]; then
|
||||
if [ $($USER_COMMAND) ]; 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 [ -z "$RESULT_ROOT_COMMAND" ] || [ -z "$RESULT_USER_COMMAND" ]; then
|
||||
if [ $($ROOT_COMMAND) ] || [ $($USER_COMMAND) ]; then
|
||||
RESULT=0;
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue