diff options
Diffstat (limited to 'conf/sysvinit-catalyst-fastcgi.example')
-rwxr-xr-x | conf/sysvinit-catalyst-fastcgi.example | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/conf/sysvinit-catalyst-fastcgi.example b/conf/sysvinit-catalyst-fastcgi.example new file mode 100755 index 000000000..d8e165a2b --- /dev/null +++ b/conf/sysvinit-catalyst-fastcgi.example @@ -0,0 +1,53 @@ +#! /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 FastCGI app server for the "FixMyStreet" site +# Description: The FastCGI 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=fms-catalyst-fastcgi +DESC="FixMyStreet app server" +USER=fms + +echo $DAEMON +test -f $DAEMON || exit 0 + +set -e + +start_daemon() { + su -l -c "$SITE_HOME/fixmystreet/bin/cron-wrapper $SITE_HOME/fixmystreet/web/fixmystreet_app_fastcgi.cgi -d -l :9000 -n 2" $USER +} + +stop_daemon() { + pkill -f perl-fcgi -u $USER || true +} + +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 |