aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-09-17 17:55:06 +0100
committerMark Longair <mhl@pobox.com>2013-10-29 13:52:39 +0000
commitbed4fe5eb8898069a7a9b0177fdc39e679d5990c (patch)
tree6a8ea7d4e59cfa50e47eb1111cba9fed511de35b
parentefb76eacd59bce5e356f0021f6f672244edd070b (diff)
Add a sysvinit script for starting Thin
This is a sample sysvinit script to start Thin in development mode.
-rwxr-xr-xconfig/sysvinit.example53
1 files changed, 53 insertions, 0 deletions
diff --git a/config/sysvinit.example b/config/sysvinit.example
new file mode 100755
index 000000000..443e7c3fb
--- /dev/null
+++ b/config/sysvinit.example
@@ -0,0 +1,53 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: application-thin-alaveteli
+# 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 Thin web server for the "Alaveteli" site
+# Description: The Thin web server for the "Alaveteli" 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/alaveteli
+NAME=alaveteli
+DESC="Alaveteli app server"
+USER=fms
+
+echo $DAEMON
+test -f $DAEMON || exit 0
+
+set -e
+
+start_daemon() {
+ su -l -c "cd $SITE_HOME/alaveteli && bundle exec thin -d -p 3300 -e development start" $USER
+}
+
+stop_daemon() {
+ pkill -f thin -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