s6 ordering and run-once?
Hi all, I'm studying the s6 website. The only reference I found to controlling startup order was a sentence about creating symlinks one by one. I found a sentence about run-once types of things (I think the example was bringing up the network), but then it didn't tell me *how* to run a run-once. Does anyone know if there are ways to order beyond one symlink at a time or s6-svwait? Does anyone know how to do a run-once service without putting an infinite sleep loop at the end? Also, are there any flag files, other than down, of which I should be aware? Thanks, SteveT Steve Litt June 2015 featured book: The Key to Everyday Excellence http://www.troubleshooters.com/key
Re: s6 ordering and run-once?
On 17/06/2015 02:58, Steve Litt wrote: What do you do if a oneshot requires that a longrun is already running? That is exactly the problem of mixed dependencies. The right answer is anopa (or s6-rc when it's released). Apart from that, I don't have any more of an answer than runit or daemontools do. -- Laurent
Re: s6 ordering and run-once?
On Tue, Jun 16, 2015 at 5:58 PM, Steve Litt sl...@troubleshooters.com wrote: On Wed, 17 Jun 2015 01:07:01 +0200 Laurent Bercot ska-supervis...@skarnet.org wrote: On 16/06/2015 23:33, Steve Litt wrote: Hi all, Does anyone know how to do a run-once service without putting an infinite sleep loop at the end? Oneshots are not meant to be supervised. Don't create a service directory for a oneshot. You'd run your oneshots exactly as you'd do with runit or daemontools: in a separate script. Intermixing oneshots and longruns is complex, it requires real dependency management, which is more than a process supervision suite does - supervision only handles longruns. What do you do if a oneshot requires that a longrun is already running? Is your oneshot script idempotent and safe to tie together into the longrun? If so and if you're using s6 you can fork out to the other script, block on a fifo in the services event/ directory with s6-svwait, and then continue on its way when s6-notifywhenup sends a U. It does require that your script be safe to run multiple times since it'll fire every time the service transitions from down to up but it's reasonably safe, is polling free, and works out of the box. It also tightly couples the longrun and the oneshot together at the run script level, so is only suited for custom jobs. Cheers! -- If the doors of perception were cleansed every thing would appear to man as it is, infinite. For man has closed himself up, till he sees all things thru' narrow chinks of his cavern. -- William Blake
Re: s6 ordering and run-once?
On Tue, 16 Jun 2015 20:58:35 -0400 Steve Litt sl...@troubleshooters.com 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 21 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/