On Tue, Jun 16, 2015 at 5:58 PM, Steve Litt <[email protected]> wrote: > On Wed, 17 Jun 2015 01:07:01 +0200 > Laurent Bercot <[email protected]> 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
