# -*- mode: shell-script; -*-

start on stopped finish

# we're required to have an exec line
exec /bin/true

# but it's in post-start we get to linger preventing started event
# from going out.
post-start script
    . /etc/default/lnsa.sh
    # loop until our sentinel job is known to upstart. that should have happened
    # a while ago, so this should never need to sleep
    if [ -d "$LNSA_JOBS_DIR" -a -f "$LNSA_JOBS_DIR/$LNSA_JOB" ]; then
        while :; do
            initctl status $LNSA_JOB >/dev/null 2>&1 && break
            usleep 100000
        done
    fi
end script
