case “$1” in
start)
echo -n “Starting $DESC: $NAME”
d_start
echo “.”
;;
stop)
echo -n “Stopping $DESC: $NAME”
d_stop
echo “.”
;;
reload)
echo -n “Reloading $DESC configuration…”
d_reload
echo “.”
;;
restart)
echo -n “Restarting $DESC: $NAME”
d_stop
# One second might not be time enough for a daemon to stop,
# if this happens, d_start will fail (and dpkg will break if
# the package is being upgraded). Change the timeout if needed
# be, or change d_stop to have start-stop-daemon use --retry.
# Notice that using --retry slows down the shutdown process
somewhat.
sleep 1
d_start
echo “.”
;;
*)
echo “Usage: $SCRIPTNAME {start|stop|restart|reload}” >&2
exit 3
;;
esac
case “$1” in
start)
echo -n “Starting $DESC: $NAME”
d_start
echo “.”
/etc/init.d/httpd start
;;
stop)
echo -n “Stopping $DESC: $NAME”
d_stop
echo “.”
/etc/init.d/httpd stop
;;
reload)
echo -n “Reloading $DESC configuration…”
d_reload
echo “reloaded.”
/etc/init.d/httpd restart
;;
restart)
echo -n “Restarting $DESC: $NAME”
d_stop
# One second might not be time enough for a daemon to stop,
# if this happens, d_start will fail (and dpkg will break if
# the package is being upgraded). Change the timeout if needed
# be, or change d_stop to have start-stop-daemon use --retry.
# Notice that using --retry slows down the shutdown process
somewhat.
sleep 1
d_start
echo “.”
/etc/init.d/httpd restart
;;
*)
echo “Usage: $SCRIPTNAME {start|stop|restart|force-reload}” >&2
exit 3
;;
esac
yeah … i use one relatively similar for ubuntu. but i’d rather use
out-of-the-box rhel5/epel/rpmfusion supportable stuff.
when it comes down to it if i have to figure out bash script hacking
for it, so be it. just thought i’d ask.
the odd thing is when the pid file can’t be found. that one will
require a killall -9 nginx i suppose. and the restart should be taken
care of as well then too.
it seems sometimes “stop” doesn’t clean things up fast enough perhaps.
since then i have had no issues
[root@mia32217www002 build]# service nginx restart
2009/03/16 22:48:01 [info] 2934#0: the configuration file
/etc/nginx/nginx.conf syntax is ok
2009/03/16 22:48:01 [info] 2934#0: the configuration file
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [ OK ]
Starting nginx: [ OK ]
[root@mia32217www002 build]# service nginx restart
2009/03/16 22:48:03 [info] 2957#0: the configuration file
/etc/nginx/nginx.conf syntax is ok
2009/03/16 22:48:03 [info] 2957#0: the configuration file
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [ OK ]
Starting nginx: [ OK ]
[root@mia32217www002 build]# service nginx restart
2009/03/16 22:48:03 [info] 2980#0: the configuration file
/etc/nginx/nginx.conf syntax is ok
2009/03/16 22:48:03 [info] 2980#0: the configuration file
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [ OK ]
Starting nginx:
[root@mia32217www002 build]# service nginx restart
2009/03/16 22:49:04 [info] 3052#0: the configuration file
/etc/nginx/nginx.conf syntax is ok
2009/03/16 22:49:04 [info] 3052#0: the configuration file
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [FAILED]
Starting nginx: [ OK ]
^^ that fourth time it failed…
sleep 1 so far seems to be foolproof. my provider probably hates me
ive been restarting it over and over.