aboutsummaryrefslogtreecommitdiffstats
path: root/config/sysvinit-passenger.example
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-04-30 10:07:29 +0100
committerLouise Crow <louise.crow@gmail.com>2015-04-30 10:07:29 +0100
commita48e18ac9ee891e04d6082d8efb126017e69ea87 (patch)
tree3b403941f92c3828d8ee515350b753c3edf4d7fe /config/sysvinit-passenger.example
parent842d4f92d8f2fdd9d9fcb789a62cb364cdb87d82 (diff)
parent7af5e9d7261cd963f7814274d4f16c2627d78a64 (diff)
Merge branch 'easy-ruby-version' into rails-3-develop
Diffstat (limited to 'config/sysvinit-passenger.example')
-rwxr-xr-xconfig/sysvinit-passenger.example59
1 files changed, 59 insertions, 0 deletions
diff --git a/config/sysvinit-passenger.example b/config/sysvinit-passenger.example
new file mode 100755
index 000000000..0940a4d63
--- /dev/null
+++ b/config/sysvinit-passenger.example
@@ -0,0 +1,59 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: application-passenger-!!(*= $site *)!!
+# 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 Passenger app server for the "!!(*= $site *)!!" site
+# Description: The Passenger app server for the "!!(*= $site *)!!" 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
+NAME=!!(*= $site *)!!
+SITE_HOME=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!
+DESC="Alaveteli app server"
+USER=!!(*= $user *)!!
+
+set -e
+
+start_daemon() {
+ echo -n "Starting $DESC: "
+ rm -f "$SITE_HOME/public/down.html"
+ echo "$NAME."
+}
+
+stop_daemon() {
+ echo -n "Stopping $DESC: "
+ cp "$SITE_HOME/public/down.default.html" "$SITE_HOME/public/down.html"
+ echo "$NAME."
+}
+
+restart_daemon() {
+ echo -n "Restarting $DESC: "
+ rm -f "$SITE_HOME/public/down.html"
+ touch "$SITE_HOME/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