Browse Source

Improve error logging in v-restart-service

Kristan Kenney 6 years ago
parent
commit
53fa69737f
1 changed files with 5 additions and 3 deletions
  1. 5 3
      bin/v-restart-service

+ 5 - 3
bin/v-restart-service

@@ -29,15 +29,17 @@ check_args '1' "$#" 'SERVICE'
 #----------------------------------------------------------#
 
 if [ "$service" != "iptables" ]; then
-    service $service restart >/dev/null 2>&1
+    systemctl restart $service >/dev/null 2>&1
     if [ $? -ne 0 ]; then
-        check_result $E_RESTART "$service restart failed"
+        check_result $E_RESTART "ERROR: Restart of $service failed."
+        log_history "Restart of $service failed."
     fi
 else
     $BIN/v-stop-firewall
     $BIN/v-update-firewall
     if [ $? -ne 0 ]; then
-        check_result $E_RESTART "$service restart failed"
+        check_result $E_RESTART "ERROR: Restart of $service failed."
+        log_history "Restart of $service failed."
     fi
 fi