Skip to content

Commit 3b34c94

Browse files
author
Kristan Kenney
committed
Merge remote-tracking branch 'origin/bugfix-service-restart'
2 parents d3e27fa + 1f914a0 commit 3b34c94

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

bin/v-add-mail-domain-ssl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
8686

8787
# Restarting mail server
8888
$BIN/v-restart-mail $restart
89-
$BIN/v-restart-service $IMAP_SYSTEM $restart
9089
check_result $? "Mail restart failed" >/dev/null
9190

9291
# Restarting web server

bin/v-change-mail-domain-sslcert

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ add_mail_ssl_config
5757

5858
# Restarting mail server
5959
$BIN/v-restart-mail $restart
60-
$BIN/v-restart-service $IMAP_SYSTEM $restart
6160

6261
check_result $? "Mail restart failed" >/dev/null
6362

bin/v-change-sys-hestia-ssl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ cp -f $ssl_dir/certificate.key $HESTIA/ssl/certificate.key
6161
# Restarting web server
6262
if [ "$restart" != 'no' ]; then
6363
kill -HUP $(cat /var/run/hestia-nginx.pid)
64-
$BIN/v-restart-mail
65-
if [ ! -z "$IMAP_SYSTEM" ]; then
66-
v-restart-service "$IMAP_SYSTEM"
67-
fi
64+
$BIN/v-restart-mail $restart
6865
fi
6966

7067
# Logging

bin/v-restart-service

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
2323
#----------------------------------------------------------#
2424

2525
check_args '1' "$#" 'SERVICE'
26+
service_status=$(pgrep $service)
2627

2728
#----------------------------------------------------------#
2829
# Action #
2930
#----------------------------------------------------------#
3031

32+
# Restart service if not running instead of trying to reload
33+
if [ -z "$service_status" ]; then
34+
force="yes"
35+
fi
36+
3137
if [ "$service" = "iptables" ]; then
3238
# Run the restart rules for iptables firewall
3339
$BIN/v-stop-firewall
@@ -38,11 +44,15 @@ elif [ -z "$force" -o "$force" = "no" ] && [ \
3844
"$service" = "exim4" -o \
3945
"$service" = "dovecot" -o \
4046
"$service" = "bind9" -o \
47+
"$service" = "named" -o \
4148
"$service" = "vsftpd" -o \
49+
"$service" = "proftpd" -o \
4250
"$service" = "ssh" -o \
4351
"$service" = "fail2ban" ]; then
52+
sleep 1
4453
systemctl reload $service > /dev/null 2>&1
4554
else
55+
sleep 1
4656
systemctl restart $service > /dev/null 2>&1
4757
fi
4858

bin/v-update-host-certificate

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,8 @@ $BIN/v-restart-proxy
8080
if [ ! -z "$MAIL_SYSTEM" ]; then
8181
# Restart exim (and dovecot if applicable)
8282
$BIN/v-restart-mail
83-
if [ ! -z "$IMAP_SYSTEM" ]; then
84-
$BIN/v-restart-service "$IMAP_SYSTEM"
85-
fi
8683
fi
87-
$BIN/v-restart-service "hestia"
84+
$BIN/v-restart-service hestia
8885

8986
#----------------------------------------------------------#
9087
# Hestia #

func/upgrade.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ upgrade_restart_services() {
211211
if [ ! -z "$MAIL_SYSTEM" ]; then
212212
$BIN/v-restart-mail $restart
213213
fi
214-
if [ ! -z "$IMAP_SYSTEM" ]; then
215-
$BIN/v-restart-service $IMAP_SYSTEM $restart
216-
fi
217214
if [ ! -z "$WEB_SYSTEM" ]; then
218215
$BIN/v-restart-web $restart
219216
$BIN/v-restart-proxy $restart

0 commit comments

Comments
 (0)