标签:简单的nginx启动脚本
初学时写的一个简单nginx启动脚本,使用定义函数和传参的方法。(生产环境中是不能用pkill来杀服务的,要使用-s reload来平滑重启)
[sa@nginx-04]# cat start_nginx04.sh
#!/bin/sh
./etc/init.d/functions
start_nginx=/nginx/sbin/nginx
USAGE(){
echo "USAGE $0{start|stop|restart}"
exit 1
}
if [ $# -ne 1 ]
then
USAGE
fi
if [ "$1"== "start" ]
then
$start_nginx
action "start nginx" /bin/true
elif ["$1" == "stop" ]
then
pkill nginx
action "stop nginx" /bin/true
elif ["$1" == "restart" ]
then
pkill nginx
sleep 2
$start_nginx
action "restart nginx" /bin/true
else
USAGE
fi
标签:简单的nginx启动脚本
原文地址:http://hejianping.blog.51cto.com/11279690/1748701