Browse Source

Update check_service.sh

Update check via systemctl for Linux with grep to produce better output for systemctl.
Thorian93 8 năm trước cách đây
mục cha
commit
939de4b432
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      check_service.sh

+ 2 - 1
check_service.sh

@@ -4,6 +4,7 @@
 # 2015-03-09 [Pascal Hegy] - Add sudo for linux
 # 2015-03-09 [Pascal Hegy] - Add sudo for linux
 # 2015-03-09 [Pascal Hegy] - Change USER variable to USERNAME to avoid the use and confusion with the USER env variable
 # 2015-03-09 [Pascal Hegy] - Change USER variable to USERNAME to avoid the use and confusion with the USER env variable
 # 2017-08-30 [Roberto Leibman] - Reordered checks to make sure dead and inactive get checked first
 # 2017-08-30 [Roberto Leibman] - Reordered checks to make sure dead and inactive get checked first
+# 2018-04-25 [Robin Gierse] - Update check via systemctl for Linux with grep to produce better output for systemctl
 
 
 ########
 ########
 # Examples:
 # Examples:
@@ -71,7 +72,7 @@ determine_service_tool() {
 TRUST_EXIT_CODE=0
 TRUST_EXIT_CODE=0
 if [[ $OS == linux ]]; then
 if [[ $OS == linux ]]; then
         if command -v systemctl >/dev/null 2>&1; then
         if command -v systemctl >/dev/null 2>&1; then
-                SERVICETOOL="systemctl status $SERVICE"
+                SERVICETOOL="systemctl status $SERVICE | grep -i Active"
                 LISTTOOL="systemctl"
                 LISTTOOL="systemctl"
                 if [ $USERNAME ]; then
                 if [ $USERNAME ]; then
                     SERVICETOOL="sudo -u $USERNAME systemctl status $SERVICE"
                     SERVICETOOL="sudo -u $USERNAME systemctl status $SERVICE"