Hi,<br><br>I find "reload" can get the job done.<br><br>But if I wantt o enable #gzip on; , I still need to reboot the server after I changed the conf file (I am not 100% sure about this, but all my stuffs working after I reboot the server, I can't just use "reload" comand to get it works"). <br>
<br>At first, I just think the restart process is just like apache, but nginx really does it better. You can archive zero downtime time if you restart it correctly :-).<br><br>Max<br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 12:18 AM, Ian Hobson <span dir="ltr"><<a href="mailto:ian@ianhobson.co.uk">ian@ianhobson.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Igor Sysoev wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Have not Linux init scripts a "reload" option to gracefully restart service<br>
using -HUP ?<br>
<br>
<br>
</blockquote></div>
Hi,<br>
<br>
I use the following under Ubuntu - and restart works fine since I changed the sleep 1 to sleep 2.<br>
<br>
This is /etc/init.d/nginx - you will need to chmod +x /etc/init.d/nginx before use.<br>
<br>
#! /bin/sh<br>
### BEGIN INIT INFO<br>
# Provides: nginx<br>
# Required-Start: $all<br>
# Required-Stop: $all<br>
# Default-Start: 2 3 4 5<br>
# Default-Stop: 0 1 6<br>
# Short-Description: starts the nginx web server<br>
# Description: starts nginx using start-stop-daemon<br>
### END INIT INFO<br>
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br>
DAEMON=/usr/sbin/nginx<br>
NAME=nginx<br>
DESC=nginx<br>
test -x $DAEMON || exit 0<br>
# Include nginx defaults if available<br>
if [ -f /etc/default/nginx ] ; then<br>
. /etc/default/nginx<br>
fi<br>
set -e<br>
case "$1" in<br>
start)<br>
echo -n "Starting $DESC: "<br>
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS<br>
echo "$NAME."<br>
;;<br>
stop)<br>
echo -n "Stopping $DESC: "<br>
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON<br>
echo "$NAME."<br>
;;<br>
restart|force-reload)<br>
echo -n "Restarting $DESC: "<br>
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON<br>
sleep 2<br>
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS<br>
echo "$NAME."<br>
;;<br>
reload)<br>
echo -n "Reloading $DESC configuration: "<br>
start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON<br>
echo "$NAME."<br>
;;<br>
*)<br>
N=/etc/init.d/$NAME<br>
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2<br>
exit 1<br>
;;<br>
esac<br>
exit 0<br>
<br>
regards<br><font color="#888888">
<br>
Ian<br>
<br>
</font></blockquote></div><br>