forked from zensh/jsgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forever
38 lines (34 loc) · 854 Bytes
/
forever
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# chkconfig: 345 88 08
# description: Forever for Node.js
DEAMON=/home/www/jsgen/app.js
LOG=/home/www/jsgen/mylogs/forever.log
PID=/root/.forever/pids/forever.pid
export PATH=$PATH:/usr/bin/node/bin
export NODE_PATH=$NODE_PATH:/usr/bin/node/lib/node_modules
node=node
forever=forever
case "$1" in
start)
$forever start -l $LOG --pidFile $PID -a $DEAMON
;;
stop)
$forever stop --pidFile $PID $DEAMON
;;
stopall)
$forever stopall --pidFile $PID
;;
restartall)
$forever restartall --pidFile $PID
;;
reload|restart)
$forever restart -l $LOG --pidFile $PID -a $DEAMON
;;
list)
$forever list
;;
*)
echo "Usage: /etc.init.d/node {start|stop|restart|reload|stopall|restartall|list}"
exit 1
;;
esac