这个脚本,可以满足nginx开启,停止和重启的操作
#!/bin/bash
. /etc/init.d/functions
function usage() {
echo $usage:$0 {start|stop|restart}
exit 1
}
function start() {
/usr/local/nginx/sbin/nginx
sleep 1
if [ `netstat -antlpe | grep nginx | wc -l` -ge 0 ];then
action nginx is started. /bin/true
else
act