######################################################################### # 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/functions nginx=/usr/local/nginx/sbin/nginx PID=/usr/local/nginx/logs/nginx.pid prog=nginx RETVAL=0 start(){ 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
时间: 2024-12-14 05:18:48