#!/command/execlineb

/command/emptyenv
/command/export PATH /command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin

/command/redirfd -r 0 /dev/null
redirfd -w 1 /dev/null
redirfd -w 2 /dev/null

foreground
{
  multisubstitute
  {
    elglob -0 DIR /service/*
    elglob -0 DIRLOG /service/*/log
  }
  svc -dx $DIR $DIRLOG
}

pipeline -w
{
  readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................
}

fdmove -c 2 1
svscan /service

# That is better than the stock shell svscanboot, because it
# actually _execs_ into svscan, instead of leaving a useless /bin/sh
# hanging around. (Most shells do not know how to exec into one side
# of a pipeline.)
