@@ -23,37 +23,30 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
2323
2424check_args ' 1' " $# " ' SERVICE'
2525
26-
2726# ----------------------------------------------------------#
2827# Action #
2928# ----------------------------------------------------------#
3029
31- Blacklist=(" iptables" ," cron" ," mysql" ," mariadb" ," hestia" )
32-
33-
34- for BannedService in Blackist; do
35- if [ " $service " = " $BannedService " ]; then
36- systemctl restart $service > /dev/null 2>&1
37- check_result $E_RESTART " ERROR: Restart of $service failed."
38- log_history " Restart of $service failed."
39- fi
40- done
41-
30+ # Run the restart rules for iptables firewall
4231if [ " $service " = " iptables" ]; then
43- # Restart rules for firewall
4432 $BIN /v-stop-firewall
4533 $BIN /v-update-firewall
4634fi
4735
48- systemctl reload $service > /dev/null 2>&1
49- if [ $? -ne 0 ]; then
50- check_result $E_RESTART " ERROR: Restart of $service failed."
51- log_history " Restart of $service failed."
52- fi
53-
36+ if [ " $service " = " hestia" ] || [ " $service " = " iptables" ] || [ " $service " = " mariadb" ] || [ " $service " = " mysql" ] || [ " $service " = " postgresql" ] || [ " $service " = " cron" ]; then
37+ systemctl restart $service > /dev/null 2>&1
38+ else
39+ systemctl reload $service > /dev/null 2>&1
40+ fi
5441
5542# ----------------------------------------------------------#
5643# Hestia #
5744# ----------------------------------------------------------#
5845
46+ # Check the result of the service restart and report whether it failed.
47+ if [ $? -ne 0 ]; then
48+ check_result $E_RESTART " ERROR: Restart of $service failed."
49+ log_history " Restart of $service failed."
50+ fi
51+
5952exit
0 commit comments