#!/command/execline -P

# This run script cleans all the s6 fifodirs once a day.
# If you don't know what this is all about, go check:
# http://www.skarnet.org/software/s6/

fdmove -c 2 1
if
  " forbacktickx" " -p" " -0" " i" "  s6-ls" "  -0" "  /service" " "
  " foreground"
    "  if" "   s6-test" "   -d" "   /service/${i}/log" "  "
    "  s6-cleanfifodir" "  /service/${i}/log/event"
  " "
  " s6-cleanfifodir" " /service/${i}/event"
""
s6-setuidgid nobody
s6-sleep 86400

# Unpleasant, right ?
# Just stick to the execlineb syntax.
