[Bast-commits] r8323 - ironman/IronMan-Web/script

idn at dev.catalyst.perl.org idn at dev.catalyst.perl.org
Fri Jan 15 16:07:02 GMT 2010


Author: idn
Date: 2010-01-15 16:07:02 +0000 (Fri, 15 Jan 2010)
New Revision: 8323

Added:
   ironman/IronMan-Web/script/local-ironboy-newsfeed
Log:
Adding init.d script for FastCGI

Added: ironman/IronMan-Web/script/local-ironboy-newsfeed
===================================================================
--- ironman/IronMan-Web/script/local-ironboy-newsfeed	                        (rev 0)
+++ ironman/IronMan-Web/script/local-ironboy-newsfeed	2010-01-15 16:07:02 UTC (rev 8323)
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# This script is placed within /etc/init.d to start the FastCGI server
+
+BASEDIR=/var/www/ironboy.enlightenedperl.org
+
+NAME=ironboy-newsfeed
+SERVER=$BASEDIR/ironman/IronMan-Web/script/ironman_web_fastcgi.pl
+SOCKET=$BASEDIR/docroot/ironman-newsfeed.sock
+#SOCKET=/var/run/ironman/ironman.sock
+PIDFILE=/var/run/ironboy/ironman.pid
+NPROCS=3
+RUNAS=ironboy
+PERL5LIB=$BASEDIR/ironman/plagger/lib:$BASEDIR/perl5/lib/perl5
+ENV=/usr/bin/env
+PERL=/usr/bin/perl
+
+. /lib/lsb/init-functions
+
+function start() {
+  log_begin_msg "Starting FCGI process $NAME..."
+  if [ -f "$PIDFILE" ]
+  then
+    log_progress_msg "$PIDFILE exists: already running"
+    log_end_msg 0
+    EXIT_STATUS=0
+  else
+    sudo -u "$RUNAS" -H "$ENV" PERL5LIB="$PERL5LIB" "$PERL" "$SERVER" -L "$SOCKET" -p "$PIDFILE" -n "$NPROCS" -d
+    EXIT_STATUS=$?
+    log_end_msg $EXIT_STATUS
+  fi
+}
+
+function stop() {
+  log_begin_msg "Stopping FCGI process $NAME..."
+  if [ -f "$PIDFILE" ]
+  then
+    sudo -u "$RUNAS" kill $(<$PIDFILE)
+    EXIT_STATUS=$?
+    log_end_msg $?
+  else
+    log_progress_msg "$PIDFILE does not exist: not running?"
+    log_end_msg 0
+    EXIT_STATUS=0
+  fi
+}
+
+function restart() {
+  stop
+  start
+}
+
+case "$1" in
+  start|stop|restart)
+    "$1"
+    ;;
+
+  *)
+    echo "$0: Do what? start, stop or restart" >&2
+    ;;
+esac
+
+exit $EXIT_STATUS
+


Property changes on: ironman/IronMan-Web/script/local-ironboy-newsfeed
___________________________________________________________________
Name: svn:executable
   + *




More information about the Bast-commits mailing list