File tree Expand file tree Collapse file tree 3 files changed +43
-12
lines changed
Expand file tree Collapse file tree 3 files changed +43
-12
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22# info: restart service
3- # options: service
3+ # options: service [RESTART]
44#
55# The function restarts system service.
66
@@ -22,7 +22,7 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
2222# Verifications #
2323# ----------------------------------------------------------#
2424
25- check_args ' 1' " $# " ' SERVICE'
25+ check_args ' 1' " $# " ' SERVICE [RESTART] '
2626is_format_valid ' service' ' restart'
2727
2828# ----------------------------------------------------------#
@@ -72,6 +72,11 @@ for service in $service_list; do
7272 fi
7373done
7474
75+
76+ # ----------------------------------------------------------#
77+ # Hestia #
78+ # ----------------------------------------------------------#
79+
7580# Logging
7681log_event " $OK " " $ARGUMENTS "
7782
Original file line number Diff line number Diff line change @@ -21,23 +21,36 @@ source $HESTIA/func/main.sh
2121# ----------------------------------------------------------#
2222
2323check_args ' 1' " $# " ' SERVICE'
24+ is_format_valid ' service'
2425
2526
2627# ----------------------------------------------------------#
2728# Action #
2829# ----------------------------------------------------------#
2930
30- if [ " $service " != ' iptables' ]; then
31- systemctl start $service > /dev/null 2>&1
32- check_result $? " ERROR: $service start failed" $E_RESTART
31+ if [ " $service " = " php-fpm" ]; then
32+ for php_ver in $( multiphp_versions) ; do
33+ service_list=" ${service_list} php${php_ver} -fpm"
34+ done
3335else
34- $BIN /v-update-firewall
35- check_result $? " ERROR: $service start failed" $E_RESTART
36+ service_list=" $service "
3637fi
3738
39+ for service in $service_list ; do
40+ if [ " $service " = " iptables" ]; then
41+ $BIN /v-update-firewall
42+ else
43+ systemctl start $service > /dev/null 2>&1
44+ fi
45+ check_result $? " ERROR: $service start failed" $E_RESTART
46+ done
47+
3848
3949# ----------------------------------------------------------#
4050# Hestia #
4151# ----------------------------------------------------------#
4252
53+ # Logging
54+ log_event " $OK " " $ARGUMENTS "
55+
4356exit
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ source $HESTIA/func/main.sh
2121# ----------------------------------------------------------#
2222
2323check_args ' 1' " $# " ' SERVICE'
24+ is_format_valid ' service'
2425
2526# Perform verification if read-only mode is enabled
2627check_hestia_demo_mode
@@ -30,17 +31,29 @@ check_hestia_demo_mode
3031# Action #
3132# ----------------------------------------------------------#
3233
33- if [ " $service " != ' iptables' ]; then
34- systemctl stop $service > /dev/null 2>&1
35- check_result $? " ERROR: $service stop failed" $E_RESTART
34+ if [ " $service " = " php-fpm" ]; then
35+ for php_ver in $( multiphp_versions) ; do
36+ service_list=" ${service_list} php${php_ver} -fpm"
37+ done
3638else
37- $BIN /v-stop-firewall
38- check_result $? " ERROR: $service stop failed" $E_RESTART
39+ service_list=" $service "
3940fi
4041
42+ for service in $service_list ; do
43+ if [ " $service " = " iptables" ]; then
44+ $BIN /v-stop-firewall
45+ else
46+ systemctl stop $service > /dev/null 2>&1
47+ fi
48+ check_result $? " ERROR: $service stop failed" $E_RESTART
49+ done
50+
4151
4252# ----------------------------------------------------------#
4353# Hestia #
4454# ----------------------------------------------------------#
4555
56+ # Logging
57+ log_event " $OK " " $ARGUMENTS "
58+
4659exit
You can’t perform that action at this time.
0 commit comments