Просмотр исходного кода

Merge remote-tracking branch 'origin/bugfix-service-restart'

Kristan Kenney 6 лет назад
Родитель
Сommit
3b34c945dd

+ 0 - 1
bin/v-add-mail-domain-ssl

@@ -86,7 +86,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
 
 # Restarting mail server
 $BIN/v-restart-mail $restart
-$BIN/v-restart-service $IMAP_SYSTEM $restart
 check_result $? "Mail restart failed" >/dev/null
 
 # Restarting web server

+ 0 - 1
bin/v-change-mail-domain-sslcert

@@ -57,7 +57,6 @@ add_mail_ssl_config
 
 # Restarting mail server
 $BIN/v-restart-mail $restart
-$BIN/v-restart-service $IMAP_SYSTEM $restart
 
 check_result $? "Mail restart failed" >/dev/null
 

+ 1 - 4
bin/v-change-sys-hestia-ssl

@@ -61,10 +61,7 @@ cp -f $ssl_dir/certificate.key $HESTIA/ssl/certificate.key
 # Restarting web server
 if [ "$restart" != 'no' ]; then
     kill -HUP $(cat /var/run/hestia-nginx.pid)
-    $BIN/v-restart-mail
-    if [ ! -z "$IMAP_SYSTEM" ]; then
-        v-restart-service "$IMAP_SYSTEM"
-    fi
+    $BIN/v-restart-mail $restart
 fi
 
 # Logging

+ 10 - 0
bin/v-restart-service

@@ -23,11 +23,17 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
 #----------------------------------------------------------#
 
 check_args '1' "$#" 'SERVICE'
+service_status=$(pgrep $service)
 
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Restart service if not running instead of trying to reload
+if [ -z "$service_status" ]; then
+    force="yes"
+fi
+
 if [ "$service" = "iptables" ]; then
     # Run the restart rules for iptables firewall
     $BIN/v-stop-firewall
@@ -38,11 +44,15 @@ elif [ -z "$force" -o "$force" = "no" ] && [ \
         "$service" = "exim4" -o     \
         "$service" = "dovecot" -o   \
         "$service" = "bind9" -o     \
+        "$service" = "named" -o     \
         "$service" = "vsftpd" -o    \
+        "$service" = "proftpd" -o    \
         "$service" = "ssh" -o       \
         "$service" = "fail2ban" ]; then
+    sleep 1
     systemctl reload $service > /dev/null 2>&1
 else
+    sleep 1
     systemctl restart $service > /dev/null 2>&1
 fi
 

+ 1 - 4
bin/v-update-host-certificate

@@ -80,11 +80,8 @@ $BIN/v-restart-proxy
 if [ ! -z "$MAIL_SYSTEM" ]; then
     # Restart exim (and dovecot if applicable)
     $BIN/v-restart-mail
-    if [ ! -z "$IMAP_SYSTEM" ]; then
-        $BIN/v-restart-service "$IMAP_SYSTEM"
-    fi
 fi
-$BIN/v-restart-service "hestia"
+$BIN/v-restart-service hestia
 
 #----------------------------------------------------------#
 #                       Hestia                             #

+ 0 - 3
func/upgrade.sh

@@ -211,9 +211,6 @@ upgrade_restart_services() {
     if [ ! -z "$MAIL_SYSTEM" ]; then
         $BIN/v-restart-mail $restart
     fi
-    if [ ! -z "$IMAP_SYSTEM" ]; then
-        $BIN/v-restart-service $IMAP_SYSTEM $restart
-    fi
     if [ ! -z "$WEB_SYSTEM" ]; then
         $BIN/v-restart-web $restart
         $BIN/v-restart-proxy $restart