#!/bin/bash# Create by wxh 2015-07-05# Version: v0.1. /etc/rc.d/init.d/functionsnginx=/usr/local/nginx/sbin/nginxprog=nginxpidfile=/usr/local/nginx/logs/nginx.pidRETVAL=0start() {echo -n $"Starting $prog: "$nginx -t &> /dev/nullif [ $? -eq 0 ];then$nginx &> /dev/null && success || failurefiechoRETVAL=$?return $RETVAL}stop() {echo -n $"Stopping $prog: "$nginx -s stop &> /dev/null && success || failureechoRETVAL=$?}reload() {echo -n $"Reloading $prog: "$nginx -s reload &> /dev/null && success || failureecho}# See how we were called.case "$1" instart)start;;stop)stop;;restart)stopstart;;reload)reload;;status)status -p ${pidfile} $nginxRETVAL=$?;;help)$nginx -hRETVAL=$?;;*)echo $"Usage: $prog {start|stop|restart|reload|help|status}"RETVAL=1esacexit $RETVAL