Re: s6 "really up" event hack

From: Patrick Mahoney <pat_at_polycrystal.org>
Date: Mon, 12 Jan 2015 10:59:23 -0600

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
}

$_at_
========================================

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 <pat_at_polycrystal.org>
Received on Mon Jan 12 2015 - 16:59:23 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC