blob: 6b47c4371819b8247611e2ed2ac3a785bdb18ea0 (
plain)
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: application-catalyst-fixmystreet
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the app server for the "FixMyStreet" site
# Description: The application server for the "FixMyStreet" site
### END INIT INFO
# This example sysvinit script is based on the helpful example here:
# http://richard.wallman.org.uk/2010/02/howto-deploy-a-catalyst-application-using-fastcgi-and-nginx/
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SITE_HOME=/var/www/fixmystreet
NAME=fixmystreet
DESC="FixMyStreet app server"
USER=fms
PIDFILE=${SITE_HOME}/${NAME}.pid
LOGDIR=${SITE_HOME}/logs
echo $DAEMON
test -f $DAEMON || exit 0
set -e
start_daemon() {
su -l -c "cd $SITE_HOME/fixmystreet && script/server --port 9000 --env deployment --daemonize --pid $PIDFILE --access-log $LOGDIR/$NAME.access.log --error-log $LOGDIR/$NAME.error.log" $USER
}
stop_daemon() {
if [ -e "$PIDFILE" ]; then
kill -TERM `cat $PIDFILE`
else
echo "No $PIDFILE found, skipping KILL."
fi
}
case "$1" in
start)
start_daemon
;;
stop)
stop_daemon
;;
reload|restart|force-reload)
stop_daemon
sleep 5
start_daemon
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|