文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Nginx启动脚本

Nginx启动脚本

时间:2010-09-14  来源:hnchenmin

最近在弄heartbeat crm模式,由于crm模式要一定要OCF或LSB的启动脚本,没办法只能自己动手写了: #! /bin/bash
# chkconfig: - 67 19
# description: Nginx Web Server
. /etc/rc.d/init.d/functions
nginxconf=/usr/local/nginx/conf/nginx.conf
nginxpid=/usr/local/nginx/logs/nginx.pid
nginxd=/usr/local/nginx/sbin/nginx
RETVAL=0
prog=nginx
if test -e $nginxd && test -e $nginxconf
   then
        echo OK > /dev/null
   else
        echo "$nginxd or $nginxconf was miss please check it!"
        exit 1
fi
if test -x $nginxd
   then
       echo ok > /dev/null
   else
       echo "$nginxd Permission deny"
       exit
fi
function nginxstart {
if test -e $nginxpid
   then
       echo "The nginx is already running!"
       exit
   else
       echo -n $"Starting $prog:"
       daemon  $nginxd
       RETVAL=$?
       echo ""
       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx
fi  
}
function nginxstop {
echo -n $"Stopping $prog:"
killproc $nginxd
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/nginx
echo ""
}         
function nginxreload {
echo -n $"Reloading $prog:"
echo ""
$nginxd -t
if test $? != 0
   then
       exit
   else
       killproc $nginxd -HUP
       echo ""
fi
}
  
case "$1" in
start)
     nginxstart
     RETVAL=$?
     ;;
status)
     status $nginxd
     RETVAL=$?
     ;;
stop)
     nginxstop
     RETVAL=$?
     ;;
restart)
    nginxstop
    nginxstart
    RETVAL=$?
    ;;
reload)
    nginxreload
    RETVAL=$?
    ;;
test)
    $nginxd -t
    RETVAL=$?
    ;;
*)
echo $"Usage: $prog {start|stop|restart|reload|restart|test}"
esac
exit $RETVAL
  完成!
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载