I just wrote this InitV startup script for Instiki running on Mongrels on
Redhat Enterprise Linux 4.3 (RHEL4U3).

Tony

#!/bin/sh
# file: /usr/bin/mongrel_start
# author: Tony Perrie

cd /var/www/html/wiki
PWD=/var/www/html/wiki /usr/bin/ruby /usr/bin/mongrel_rails start -p 4001 \
-P /var/run/mongrel_instiki.pid -l /var/www/html/wiki/log/mongrel.log \
> /var/www/html/wiki/log/mongrel_stdout.log 2>&1

#!/bin/bash
# instiki        Mongrel startup script for Instiki
# author:        Tony Perrie
#
# chkconfig: - 85 15
# description: This is a startup script for a mongrel process that
#              that is proxied behind an Apache VHost
# processname: mongrel_rails
# pidfile: /var/run/mongrel_instiki.pid

# Source function library.
. /etc/rc.d/init.d/functions

prog="instiki"
instiki=${INSTIKI-/usr/bin/mongrel_start}
pidfile=${PIDFILE-/var/run/mongrel_instiki.pid}
lockfile=${LOCKFILE-/var/lock/subsys/mongrel_instiki}
RETVAL=0
start() {
        action $"Starting $prog: " /bin/true
        $instiki &
        touch /var/www/html/wiki/log/mongrel.log
        RETVAL=$?
        [ $RETVAL = 0 ] && touch ${lockfile}
             return $RETVAL
}

stop() {
  action $"Stopping $prog: " /bin/true
  MONGRELPID=$(ps auxwww | grep mongrel | grep -v grep | awk ' { print $2 }
')
  if [ "$MONGRELPID" != "" ]; then
    kill $MONGRELPID
  fi
}

# See how we were called.
case "$1" in
  start)
             start
             ;;
  stop)
             stop
             ;;
  status)
        status "/usr/bin/ruby /usr/bin/mongrel_rails"
             RETVAL=$?
             ;;
  restart)
             stop
             start
             ;;
  *)
             echo $"Usage: $prog {start|stop|restart}"
             exit 1
esac

exit $RETVAL


Tony

_______________________________________________
Instiki-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/instiki-users

Reply via email to