Startup script for Radiant with Mongrel

Posted by Paul Verreth Mon, 26 Mar 2007 05:54:00 GMT

Mongrel is IMHO the preferred (web)server for Ruby on Rails applications hence for Radiant.

Here you can find a startup script for Fedora linux, but of course also usable for Ubuntu, ...

#!/bin/bash
#
#    /etc/rc.d/init.d/radiant_cms
#
# Start mongrel & radiant
#
# chkconfig: - 65 35
# description: Mongrel & radiant
# processname: mongrel
# Source function library.
. /etc/init.d/functions

MONGREL=/usr/bin/mongrel_rails
RAILSDIR=/var/www/radiant
CONFFILE=mongrel_config

test -x $MONGREL || exit 0

RETVAL=0
prog="Mongrel for radiant" 

start() {
        echo -n $"Starting $prog: " 
    cd $RAILSDIR
    $MONGREL start -C $CONFFILE
    RETVAL=$?
    echo
}

stop() {
    echo -n $"Stopping $prog: " 
    cd $RAILSDIR
    $MONGREL stop
    RETVAL=$?
    echo
}

#
#    See how we were called.
#
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart}" 
    exit 1
esac

exit $RETVAL
Read more...

Posted in ,  | Tags ,