Re: s6: something like runit's ./check script

From: Laurent Bercot <ska-supervision_at_skarnet.org>
Date: Thu, 3 Sep 2015 00:07:16 +0200

On 02/09/2015 23:14, Buck Evan wrote:
> Given a daemon that doesn't have a readyfile feature, I'd like to write a
> `check` script and hook it up to s6's readiness notification
> <http://skarnet.org/software/s6/notifywhenup.html>.

echo 3 > notification-fd

mv run run.real

cat > run <<EOF
#!/command/execlineb -P
background -d
{
   fdmove 1 3
   forx -x 0 dummy { 1 2 3 4 5 6 7 }
   ifelse { ./check } { echo }
   foreground { sleep 1 }
   exit 1
}
fdclose 3
./run.real
EOF

chmod 755 run

  Untested, but that should report readiness if ./check succeeds
within 7 attempts at running it, with 1 second between attempts.
How it works is left as an exercise to the reader. %-P

-- 
  Laurent
Received on Wed Sep 02 2015 - 22:07:16 UTC

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