-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodejs
44 lines (43 loc) · 958 Bytes
/
nodejs
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
39
40
41
42
43
#############################################################
##NODEJS INIT Script
#############################################################
#!/bin/sh
#
# Note runlevel 2345, 86 is the Start order and 85 is the Stop order
#
# chkconfig: 2345 86 85
# description: Description of the Service
#
# Below is the source function library, leave it be
. /etc/init.d/functions
# result of whereis forever or whereis node
export PATH=$PATH:/usr/local/bin
# result of whereis node_modules
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules
start(){
NODE_ENV=production forever start PATH_TO_NODE_SCRIPT
}
stop(){
NODE_ENV=production forever stop PATH_TO_NODE_SCRIPT
}
restart(){
NODE_ENV=production forever restart PATH_TO_NODE_SCRIPT
}
case "$1" in
start)
echo "Start service SERVICE_NAME"
start
;;
stop)
echo "Stop service SERVICE_NAME"
stop
;;
restart)
echo "Restart service SERVICE_NAME"
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac