-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinitd
executable file
·48 lines (44 loc) · 911 Bytes
/
initd
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
#!/bin/bash
HOME=$(cd `dirname $0` && pwd)
DAEMON=encipher.coffee
USER=encipher
GROUP=encipher
NODE=/home/cloudpub/cloudpub/bin/node
OPTS="--port=3000 --interface=127.0.0.1"
function start {
echo "Starting $DAEMON (home: $HOME)"
/sbin/start-stop-daemon --start \
--background \
--make-pidfile \
--pidfile /tmp/multiplay.pid \
--chdir $HOME \
--user $USER \
--group $GROUP \
--chuid $USER \
--exec $NODE -- $HOME/$DAEMON $OPTS
}
function stop {
echo "Stopping $DAEMON"
/sbin/start-stop-daemon --stop --pidfile /tmp/multiplay.pid --verbose
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
console)
sudo -u $USER -g $GROUP $NODE $HOME/$DAEMON $OPTS
;;
*)
# Refuse to do other stuff
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0