-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathambs-starman
59 lines (51 loc) · 1.23 KB
/
ambs-starman
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
56
57
58
59
#!/bin/sh
### BEGIN INIT INFO
# Provides: ambs-starman
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starman daemon
# Description: Start and stop Starman daemon.
### END INIT INFO
DIR=/home/ambs/DicionarioAberto/api
SCRIPT=$DIR/bin/app.psgi
USER=www-data
GROUP=www-data
WORKERS=3
LISTEN=127.0.0.1:5010
ERROR_LOG=/tmp/ambs-starman.log
# If you have a permission problem,
# move PID-file to USER home directory
PIDFILE=/tmp/ambs-starman.pid
. /lib/lsb/init-functions
start() {
start-stop-daemon --start --chuid $USER --chdir $DIR \
--pidfile=$PIDFILE \
--exec /usr/bin/starman -- -D --pid $PIDFILE \
--listen $LISTEN --error-log $ERROR_LOG \
--user $USER --group $GROUP \
--workers $WORKERS $SCRIPT
}
stop() {
start-stop-daemon --stop --pidfile $PIDFILE
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status_of_proc -p $PIDFILE /usr/bin/starman "ambs-starman process" && status="0" || status="$?"
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
exit 3
;;
esac