Hi,

In some upstart script I wrote, i have multiple script (for example
post-start and pre-stop). I would like to be able to define variables
for all those scripts at the same time. And why not define shell
functions for all scripts.

So i would like to suggest a new section that can start for example
with "common script" and that would be executed before each script. So
I could merge common code.

For example:

common script
        source /etc/profile # have initctl directory in our PATH
        EXECNAME=/usr/bin/mydaemon
        source /etc/conf.d/$MYDAEMON # define $OPTS, $PIDFILE variables
end script

pre-start script
        # compatibility with old init
        test -f $PIDFILE && kill $(cat $PIDFILE)
end script

post-start script
        initctl status $MYSELF | get_pid > $PIDFILE
end script

exec $EXECNAME --foreground $OPTS

post-stop script
        rm -f $PIDFILE
end script


In fact I don't use pidfiles, except on rare cases. But that could be
useful on certain startup script where it is not as simple as exec a
daemon.

What do you think of that ?

Mildred

-- 
Mildred       <xmpp:[EMAIL PROTECTED]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to