Here's my latest attempt. I've defined
a script 's6-notifywhenup-fswatch':

========================================
#! /usr/bin/env execlineb -S0

multisubstitute
{
  define EVENT   U
  define FIFODIR event
  define FILE    ready
  define TIMEOUT 60000 # milliseconds
}

background -d
{
  if { rm -f $FILE }
if { s6-maximumtime -t $TIMEOUT fswatch -1 $FILE } # any single event on $FILE
  s6-ftrig-notify $FIFODIR $EVENT
}

$@
========================================

Using mysqld for example, inside the 'run' script:

  s6-notifywhenup-fswatch ... mysqld ...

And 'log/run':

  s6-log ... -. "+mysqld: ready for connections\." ^0 =../ready ...

Seems to work reasonably well.

--
Patrick Mahoney <[email protected]>

Reply via email to