Skip to content

Instantly share code, notes, and snippets.

@henare
Created April 9, 2015 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henare/4daaa7364bd8eedfd8ac to your computer and use it in GitHub Desktop.
Save henare/4daaa7364bd8eedfd8ac to your computer and use it in GitHub Desktop.
kedumba's Alaveteli init script that's required when deploying using Capistrano as of Alaveteli 0.19: https://github.com/mysociety/alaveteli/blob/release/0.19/doc/CHANGES.md#version-019
#! /bin/sh
### BEGIN INIT INFO
# Provides: application-righttoknow
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Provides a restart task for capistrano deployments of Right To Know
# Description: Alaveteli expects this script to be available to restart Passenger so this restarts both staging and production
### 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
NAME=righttoknow.org.au
SITE_HOME=/srv/www/test.righttoknow.org.au/current
DESC="Alaveteli app server"
USER=deploy
set -e
start_daemon() {
# echo -n "Starting $DESC: "
# rm -f "$SITE_HOME/public/down.html"
# echo "$NAME."
echo "Start: is a NOOP for the Right To Know Passenger service"
}
stop_daemon() {
# echo -n "Stopping $DESC: "
# cp "$SITE_HOME/public/down.default.html" "$SITE_HOME/public/down.html"
# echo "$NAME."
echo "Stop: is a NOOP for the Right To Know Passenger service"
}
restart_daemon() {
# echo -n "Restarting $DESC: "
# rm -f "$SITE_HOME/public/down.html"
# touch "$SITE_HOME/tmp/restart.txt"
# echo "$NAME."
echo -n "Restarting $DESC: test."
touch "/srv/www/test.righttoknow.org.au/current/tmp/restart.txt"
echo "$NAME."
echo -n "Restarting $DESC: www."
touch "/srv/www/www.righttoknow.org.au/current/tmp/restart.txt"
echo "$NAME."
}
case "$1" in
start)
start_daemon
;;
stop)
stop_daemon
;;
reload|restart|force-reload)
restart_daemon
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment