使用forever启动node.js自启动脚本备份

#!/bin/bash
#chkconfig:345 99 01
#description:start_push_server.sh

DIR='/opt/node_js/lib'
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node_js/bin
NODE_PATH='/opt/node_js/lib/node_modules'

test -x $NODE || exit 0
function start_app {
    /opt/node_js/bin/forever start -a -l /opt/lampp/vhosts/***.eceye.cn/Websocket_Server/logs/forever.log /opt/lampp/vhosts/***.eceye.cn/Websocket_Server/pserver.js
}
function stop_app {
   /opt/node_js/bin/forever stop  /opt/lampp/vhosts/***.eceye.cn/Websocket_Server/pserver.js
}
case $1 in
    start)
        start_app ;;
    stop)
        stop_app ;;
    restart)
        stop_app
        start_app
        ;;
    *)
    echo "usage: clearstonecc {start|stop}" ;;
esac
exit 0

 

发表评论