-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcanto-docker-initd
executable file
·48 lines (41 loc) · 1.28 KB
/
canto-docker-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/sh
# /etc/init.d/canto
### BEGIN INIT INFO
# Provides: canto
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Canto community annotation tool
### END INIT INFO
# Installation instructions: https://github.com/pombase/canto/blob/master/etc/canto-init.d.md
action=$1
PORT=5000
WORKERS=5
CANTO_SPACE=/var/canto-space
PID_PATH=import_export/canto.pid
if [ -f /etc/default/canto ]; then
. /etc/default/canto
fi
# Carry out specific functions when asked to by the system
case "$action" in
start)
echo "Starting Canto with $WORKERS workers"
(date; cd $CANTO_SPACE; canto/script/canto_docker --non-interactive --use-container-name start_server --pid-file=/$PID_PATH --port $PORT --signal-on-hup=QUIT --signal-on-term=QUIT -- script/canto_start --workers $WORKERS --keepalive-timeout 5 -s Starman) >> canto.log 2>&1 &
;;
stop)
pid=`/bin/cat $CANTO_SPACE/$PID_PATH`
echo stopping $pid
(cd $CANTO_SPACE; docker exec canto kill -TERM $pid)
;;
restart)
pid=`/bin/cat $CANTO_SPACE/$PID_PATH`
echo restarting $pid
(cd $CANTO_SPACE; docker exec canto kill -HUP $pid)
;;
*)
echo "Usage: $0 {start|restart|stop}"
exit 1
;;
esac
exit 0