1 进入 /etc/init.d, 新建文件 nodeserver(名字可以随便取)
cd /etc/init.d
touch nodeserver
2 编辑nodeserver
#!/bin/sh
# chkconfig: 2345 85 15
# description: Startup script for nodeserver.
# exit on first error
set -e
# points to the root for forever config
export "FOREVER_ROOT=/root/.forever"
#LOG=/data/nodeserver/log
PID=/data/nodeserver/pid
starts=(
"/usr/local/bin/forever --sourceDir /var/www/html/drunk start drunk.js"
"/usr/local/bin/forever --sourceDir /var/www/html/wx start wxapi.js"
)
# commands to run on "stop" (new line per command)
stops=(
"/usr/local/bin/forever stop --pidFile $PID /var/www/html/drunk/drunk.js"
"/usr/local/bin/forever stop --pidFil