chemzqm
2014-06-02 20:57:46 +08:00
PM2功能多一些,但是使用起来也更复杂,一般forever就够了,附送一段bash脚本
#! /bin/bash
DIR=/home/dash/__placeholder__
LOG_FOLDER=$DIR/log
DATE=`date +%Y%m%d`
mkdir -p $LOG_FOLDER
case "$1" in
start)
PORT=9380 NODE_ENV=production forever start -a -l $LOG_FOLDER/__placeholder__.log -o $LOG_FOLDER/out.log -e $LOG_FOLDER/err.log $DIR/app.js
;;
stop)
forever stop $DIR/app.js
;;
restart)
$0 stop
$0 start
;;
status)
;;
reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0