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
65
66
|
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: sloecode
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the Pylons-based application 'sloecode'
### END INIT INFO
export SLOECODE_CONFIG="/etc/sloecode/production.ini"
PASTE_OPTIONS="--pid-file=/var/run/sloecode-webapp --log-file /var/log/sloecode/webapp.log --daemon $SLOECODE_CONFIG"
TWISTD_OPTIONS="--pidfile=/var/run/sloecode-smartserver --logfile=/var/log/sloecode/smartserver.log --no_save --python /etc/default/bzrssh.tac"
smartserver_start()
{
twistd $TWISTD_OPTIONS
}
smartserver_stop()
{
if [ -e /var/run/sloecode-smartserver ]
then
kill `cat /var/run/sloecode-smartserver` || true
fi
}
smartserver_restart()
{
smartserver_stop
smartserver_start
}
case "$1" in
start)
smartserver_start
echo "Starting Sloecode"
;;
stop)
smartserver_stop
echo "Stopping Sloecode"
;;
reload)
smartserver_restart
;;
force-reload)
smartserver_restart
;;
restart)
smartserver_restart
;;
status)
# TODO: check smartserver status by looking at pid file.
;;
*)
echo "Usage: $0 {stop|start|reload}" >&2
;;
esac
|