-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
768e416
commit 8f4909c
Showing
1 changed file
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2016 Mohamed El Morabity <[email protected]> | ||
# Copyright © 2016, 2017 Mohamed El Morabity <[email protected]> | ||
# | ||
# This module is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the Free Software | ||
|
@@ -19,8 +19,8 @@ PLUGINDIR=$(dirname $0) | |
. $PLUGINDIR/utils.sh | ||
|
||
|
||
if [ $# -ne 1 ]; then | ||
echo "Usage: ${0##*/} <service name>" >&2 | ||
if [[ $# -ne 1 ]]; then | ||
echo "Usage: ${0##*/} <service name>" | ||
exit $STATE_UNKNOWN | ||
fi | ||
|
||
|
@@ -29,19 +29,19 @@ service=$1 | |
|
||
status=$(systemctl is-enabled $service 2>/dev/null) | ||
r=$? | ||
if [ -z "$status" ]; then | ||
if [[ -z "$status" ]]; then | ||
echo "ERROR: service $service doesn't exist" | ||
exit $STATE_CRITICAL | ||
fi | ||
|
||
if [ $r -ne 0 ]; then | ||
if [[ $r -ne 0 ]]; then | ||
echo "ERROR: service $service is $status" | ||
exit $STATE_CRITICAL | ||
fi | ||
|
||
|
||
systemctl --quiet is-active $service | ||
if [ $? -ne 0 ]; then | ||
if [[ $? -ne 0 ]]; then | ||
echo "ERROR: service $service is not running" | ||
exit $STATE_CRITICAL | ||
fi | ||
|