From 166a105e33c31cf8ff8295156995351e4a9d286d Mon Sep 17 00:00:00 2001 From: Blair Bonnett Date: Fri, 27 Jul 2012 12:52:08 +1200 Subject: [PATCH] Add upstart script to run uHub as a service. Start and stop conditions are based off the OpenSSH upstart script which ships with Ubuntu. --- doc/upstart/etc/init/uhub.conf | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/upstart/etc/init/uhub.conf diff --git a/doc/upstart/etc/init/uhub.conf b/doc/upstart/etc/init/uhub.conf new file mode 100644 index 0000000..8156596 --- /dev/null +++ b/doc/upstart/etc/init/uhub.conf @@ -0,0 +1,28 @@ +# uHub - a lightweight but high-performance hub for the ADC +# peer-to-peer protocol. + +description "uHub - High performance ADC peer-to-peer hub" + +# Start and stop conditions. +start on filesystem or runlevel [2345] +stop on runlevel [!2345] + +# Allow the service to respawn, but if its happening too often +# (10 times in 5 seconds) theres a problem and we should stop trying. +respawn +respawn limit 10 5 + +# The program is going to fork, and upstart needs to know this +# so it can track the change in PID. +expect fork + +# Set the mode the process should create files in. +umask 022 + +# Make sure the log folder exists. +pre-start script + mkdir -p -m0755 /var/log/uhub +end script + +# Command to run it. +exec /usr/bin/uhub -f -u uhub -g uhub -l /var/log/uhub/uhub.log -c /etc/uhub/uhub.conf