Linux startup script
daemonizedaemonize is a very simple program that allows you to launch Hudson (or any arbitrary program) as a daemon. For people without much Unix experience, this is recommended. daemontoolsdaemontools is another possibility. This is more complicated to set up and it doesn't really follow the normal Unix convention, but it offers daemon control (like start/stop), log capturing, as well as automatic restart when the service dies. Shell script # Daemonize
echo -n $"Starting $SERVICE: "
touch /var/run/hudson.pid
chown hudson:hudson /var/run/hudson.pid
su -s /bin/sh hudson -c "
cd /
HUDSON_HOME=/var/lib/hudson exec setsid /usr/bin/java \
-jar /usr/share/java/hudson/hudson.war \
$HUDSON_OPTS \
</dev/null >>/var/log/hudson/console_log 2>&1 &
echo \$! >/var/run/hudson.pid
disown \$!
"
Adjust the above for your need – it is the part of my init scripts. Java Service WrapperThe The Java Service wrapper is a wrapper that works both on Unix and Windows. It requires some set up but when it is setup it can be used as any other unix service (like start/stop). This example will install a hudson instance in /home/hudson on a debian machine. The Hudson configuration is stored in /home/hudson/data. Hudson will be running on port 8070 and as the hudson user.
ExamplesUbuntu LinuxInit Script for Hudson Continuous Integration Engine on Ubuntu Linux SuSE LinuxInit Script for Hudson Continuous Integration Engine on SuSE Linux |
