Init скрипт для nginx

Вот ломает меня ручками управлять nginx. Хотелось init скрипт. Нагуглил такой вот (работает, не жалуюсь):

#!/bin/sh
# Init file for nginx server daemon
# chkconfig: - 85 15
# description: nginx server daemon
bin=/sbin/nginx
pid_file=/usr/local/nginx/nginx.pid
case "$1" in
start)
echo -n "Starting nginx: "
$bin && echo OK || echo FAILED
;;
stop)
echo -n "Stopping nginx: "
kill `cat $pid_file` && echo OK || echo FAILED
;;
configtest)
$bin -t
;;
reload)
echo -n "Reloading nginx: "
kill -HUP `cat $pid_file` && echo OK || echo FAILED
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|configtest}"
exit 1
;;
esac

This entry was posted in Профессиональное and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">