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

Reply via email to