-
Notifications
You must be signed in to change notification settings - Fork 5
/
typogenerator-debian.sh
executable file
·64 lines (53 loc) · 1.5 KB
/
typogenerator-debian.sh
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
60
61
62
63
64
#! /bin/sh
### BEGIN INIT INFO
# Provides: TypoGenerator
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: TypoGenerator XMLRPC Service
### END INIT INFO
set -e
DAEMON=/home/typogenerator/TypoGenerator/trunk/typogenerator.py
PIDFILE=/home/typogenerator/var/run/typogenerator.pid
test -x $DAEMON || {
log_daemon_msg "Could not find or execute $DAEMON"
exit 0
}
. /lib/lsb/init-functions
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
log_daemon_msg "Starting the TypoGenerator XMLRPC service" "TypoGenerator"
if start-stop-daemon --chuid typo3 --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping TypoGenerator XMLRPC service" "TypoGenerator"
if start-stop-daemon --chuid typo3 --stop --quiet --oknodo --pidfile $PIDFILE; then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
log_daemon_msg "Restarting TypoGenerator XMLRPC service" "TypoGenerator"
start-stop-daemon --chuid typo3 --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
if start-stop-daemon --chuid typo3 --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
;;
*)
log_action_msg "Usage: /etc/init.d/typogenerator {start|stop|restart}"
exit 1
esac
exit 0