Wednesday, July 29, 2009

Hudson init script for Ubuntu 9.04

Hudson init script for ubuntu 9.04. This is available on hudson's website too.

http://wiki.hudson-ci.org/display/HUDSON/Installation+and+Execution

This is what worked for me. The one hudson website is for linux. This you can use as is without modifications (except for "RUN_AS") on ubuntu


#!/bin/sh

DESC="Hudson CI Server "
NAME=hudson
PIDFILE=/var/run/$NAME.pid
RUN_AS=sysadm

d_start() {
start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --chuid $RUN_AS --exec /usr/bin/java -- -Dhudson.scm.CVSSCM.skipChangeLog=true -jar /opt/hudson/hudson.war
}

d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE
if [ -e $PIDFILE ]
then rm $PIDFILE
fi
}

case $1 in
start)
echo -n "Starting $DESC: $NAME "
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME "
d_stop
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME "
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "usage: $NAME {start|stop|restart}"
exit 1
;;
esac

exit 0

No comments: