Skip to content

Commit 466cf25

Browse files
authored
Bringing back default restart routine for nginx
1 parent 927c288 commit 466cf25

File tree

1 file changed

+42
-30
lines changed

1 file changed

+42
-30
lines changed

bin/v-restart-proxy

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

52-
# background restart
53-
if [ "$1" = 'background' ]; then
54-
# Restart system
55-
sleep 15
56-
# rm /tmp/restart-nginx
57-
service $PROXY_SYSTEM restart >/dev/null 2>&1
58-
if [ $? -ne 0 ]; then
59-
send_email_report
60-
check_result $E_RESTART "$PROXY_SYSTEM restart failed"
61-
fi
62-
63-
# Update restart queue
64-
if [ -e "$VESTA/data/queue/restart.pipe" ]; then
65-
sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
66-
fi
67-
68-
exit;
69-
fi
70-
71-
# if [ -f "/tmp/restart-nginx" ]; then
72-
# exit;
73-
# fi
52+
if [ -f "/usr/local/vesta/web/inc/nginx_proxy" ]; then
53+
54+
# if vesta is behind default nginx, restart in background with 15 sec delay
55+
# background restart
56+
if [ "$1" = 'background' ]; then
57+
# Restart system
58+
sleep 15
59+
service $PROXY_SYSTEM restart >/dev/null 2>&1
60+
if [ $? -ne 0 ]; then
61+
send_email_report
62+
check_result $E_RESTART "$PROXY_SYSTEM restart failed"
63+
fi
64+
65+
# Update restart queue
66+
if [ -e "$VESTA/data/queue/restart.pipe" ]; then
67+
sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
68+
fi
69+
70+
exit;
71+
fi
72+
73+
# try to reload to get changes faster
74+
service $PROXY_SYSTEM reload
75+
76+
# send to background process
77+
nohup $BIN/v-restart-proxy 'background' &>/dev/null &
78+
79+
else
80+
81+
# Default behaviour
82+
# Restart system
83+
service $PROXY_SYSTEM restart >/dev/null 2>&1
84+
if [ $? -ne 0 ]; then
85+
send_email_report
86+
check_result $E_RESTART "$PROXY_SYSTEM restart failed"
87+
fi
88+
89+
# Update restart queue
90+
if [ -e "$VESTA/data/queue/restart.pipe" ]; then
91+
sed -i "/$SCRIPT/d" $VESTA/data/queue/restart.pipe
92+
fi
7493

75-
service $PROXY_SYSTEM reload
76-
# if [ $? -ne 0 ]; then
77-
# send_email_report
78-
# check_result $E_RESTART "$PROXY_SYSTEM reload failed"
79-
# fi
80-
81-
# touch /tmp/restart-nginx
82-
nohup $BIN/v-restart-proxy 'background' &>/dev/null &
94+
fi
8395

8496
#----------------------------------------------------------#
8597
# Vesta #

0 commit comments

Comments
 (0)