description "Kill Bill Open Billing Platform"
author "Pierre-Alexandre Meyer <pierre@kill-bill.org>"

start on runlevel [2345]
stop on runlevel [!2345]

pre-start script
    [ -r /etc/default/killbill-server ] && . /etc/default/killbill-server
    test -f $KILLBILL_WAR || { stop ; exit 0; }
    mkdir $KILLBILL_RUN > /dev/null 2>&1  || true
    chown -R $KILLBILL_USER $KILLBILL_RUN || true
end script

script
    [ -r /etc/default/killbill-server ] && . /etc/default/killbill-server
    export KILLBILL_HOME
    exec start-stop-daemon --start -c $KILLBILL_USER --exec $KILLBILL_START --name $NAME
end script
