On Tue, 16 Jun 2015 20:58:35 -0400 Steve Litt <[email protected]> wrote:
> > > Does anyone know how to do a run-once service without putting an > > > infinite sleep loop at the end? In perp you would simply touch(1) a file named "flag.once" in the service definition directory. See the section STARTUP MODIFICATION in the perpd(8) man page for the full story: http://b0llix.net/perp/site.cgi?page=perpd.8 > > What do you do if a oneshot requires that a longrun is already > running? > In perp you would simply use the perpok(8) utility to test for the required service, and use the runpause(8) utility to hack oneshot into a persistent process (_not_ using the "flag.once" flagfile in this case). Here is a complete perp runscript example for oneshot, as would be found in the file /etc/perp/oneshot/rc.main: #!/bin/sh exec 2>&1 if test $1 = 'start' ; then if ! perpok -u3 longrun ; then echo "dependency failure: longrun not running..." exit 1 else echo "starting oneshot..." /usr/bin/oneshot exec runpause -L 'oneshot' 0 /bin/true fi fi if test $1 = 'reset' ; then echo "resetting oneshot..." fi ### eof The relevant manual pages: perpok(8): http://b0llix.net/perp/site.cgi?page=perpok.8 runpause(8): http://b0llix.net/perp/site.cgi?page=runpause.8 Wayne http://b0llix.net/perp/
