Skip to content

Commit b04dce9

Browse files
authored
Restart nginx in background
1 parent a57c8b7 commit b04dce9

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

bin/v-restart-proxy

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,26 @@ if [ -z "$PROXY_SYSTEM" ] || [ "$PROXY_SYSTEM" = 'remote' ]; then
4949
exit
5050
fi
5151

52-
# Restart system
53-
service $PROXY_SYSTEM reload >/dev/null 2>&1
54-
if [ $? -ne 0 ]; then
55-
send_email_report
56-
check_result $E_RESTART "$PROXY_SYSTEM restart failed"
57-
fi
52+
# background restart
53+
if [ "$1" = 'background' ]; then
54+
# Restart system
55+
sleep 2
56+
service $PROXY_SYSTEM restart >/dev/null 2>&1
57+
if [ $? -ne 0 ]; then
58+
send_email_report
59+
check_result $E_RESTART "$PROXY_SYSTEM restart failed"
60+
fi
61+
62+
# Update restart queue
63+
if [ -e "$VESTA/data/queue/restart.pipe" ]; then
64+
sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
65+
fi
5866

59-
# Update restart queue
60-
if [ -e "$VESTA/data/queue/restart.pipe" ]; then
61-
sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
67+
exit;
6268
fi
6369

70+
touch /tmp/restart-nginx
71+
nohup $BIN/v-restart-proxy 'background' &>/dev/null &
6472

6573
#----------------------------------------------------------#
6674
# Vesta #

0 commit comments

Comments
 (0)