-
Notifications
You must be signed in to change notification settings - Fork 7
/
init.d.d3-workbench
executable file
·55 lines (46 loc) · 1.29 KB
/
init.d.d3-workbench
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
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# chkconfig: 345 99 10
# description: Startup/shutdown script for d3-workbench
#
### BEGIN INIT INFO
# Provides: d3-workbench
# Required-Start: $network $local_fs $remote_fs
# Required-Stop:: $network $local_fs $remote_fs
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Pyntrest flat-file image CMS
### END INIT INFO
INSTALL_PATH="/usr/local/lib/node_modules/d3-workbench"
#######################################################
# NO CHANGES BELOW THIS POINT NECESSARY IN MOST CASES #
#######################################################
NAME="d3-workbench"
LOG_FILE="/var/log/${NAME}.log"
start_daemon () {
nohup node ${INSTALL_PATH}/bin/d3-wb-server.js -i +DEMO -n >$LOG_FILE 2>&1 </dev/null &
}
stop_daemon () {
ps -ef | grep "d3-wb-server.js" | grep -v grep | awk '{print $2}' |\
while read pid; do echo "Stopping pid: $pid"; kill -9 $pid 2> /dev/null; done
}
case "$1" in
start)
echo "Starting daemon: $NAME"
start_daemon
;;
stop)
echo "Stopping daemon: $NAME"
stop_daemon
;;
restart)
echo "Restarting daemon: $NAME"
stop_daemon
start_daemon
;;
*)
echo "Usage: "$1" {start|stop|restart}"
exit 1
esac
exit 0