########################################################################## file name: nginx.sh# Author: dty# mail: [email protected]# Created Time: Sun 09 aug 2015 06:02:17 pm cst################################################################## ########!/bin/bash. /etc/rc.d/init.d/functionsnginx=/usr/local/nginx/sbin/nginxpid=/usr/local/nginx/logs/ Nginx.pidprog=nginxretval=0start () { echo -n "Starting $prog $nginx -t &> /dev/null if [ "$?" -eq 0 ];then $nginx &>/dev/null && success | | failure fi echo RETVAL=$? return $RETVAL}stop () { echo -n "Stopping $prog: " $nginx -s stop &> /dev/null & & success | | failure echo retval=$? return $ Retval}reload () { echo -n "stopping $prog:" $nginx -s reload &> /dev/null && success | | failure echo retval=? return $RETVAL }case $1 in start) start;; stop) stop;; restart) stop start;; reload) reload ;; status) status -p ${pid} $nginx RETVAL=$? ;;     HELP) $nginx -h retval=$? ;; *) echo usage (start|stop|restart|help|reload|); esac exit $RETVAL
Shell-nginx Startup scripts