nginx控制脚本
#!/bin/bash
prog=/usr/local/nginx/sbin/nginx
pidfile=/var/run/nginx/nginx.pid
lockfile=/var/lock/nginx.lock
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
start() {
[ -f $lockfile ] && echo "nginx is started" && exit
echo -n "nginx is starting...."
sleep 3
$prog && touch $lockfile && echo "ok" ||echo "fail"
}
stop() {
[ ! -f $lockfile ] && echo "nginx is stoped" && exit
echo -n "nginx is stoping...."
sleep 3
$prog -s stop && rm -rf $lockfile && echo "ok" ||echo "fail"
}
status() {
[ -f $pidfile ] && echo "the nginx server is running...pid is `cat $pidfile`" || echo "the nginx server is stoped"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
;;
*)
echo "USAGE:start|stop|status|restart"
;;
esac
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
