#!/bin/sh # # Init file for nginx server daemon # # chkconfig: - 85 15 # description: nginx server daemon # bin='/usr/local/nginx/sbin/nginx' pid_file='/usr/local/nginx/logs/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