#!/bin/sh -eu # SYNTAX: $sv [...] -- $sv_options tool=$(readlink -e "${0%/*}/..") . "$tool"/local/lib.sh "$tool"/local/apt-get-install runit if test $# = 0 then set +x sudo sv status \ $(sudo find /etc/sv \ -mindepth 1 -maxdepth 1 -type d \ -printf '%p\n' | sort) else services= while [ $# -gt 0 ] do case $1 in (--) shift; break;; (*) services="$services ${1#etc/sv/}"; shift;; esac done #for sv in $(sudo find /etc/sv \ # -mindepth 1 -maxdepth 1 -type d \ # -false $(printf -- '-or -name %s\n' $services) \ # -printf '%f\n') # do # case $(sudo sv stop "$sv" | tee /dev/stderr) in # (*": runsv not running") true;; # (*": unable to open supervise/ok: file does not exist") true;; # ("ok: down:"*) true;; # (*) false;; # esac # done for sv in $(find "$tool"/etc/sv \ -mindepth 1 -maxdepth 1 -type d \ -false $(printf -- '-or -name %s\n' $services) \ -printf '%f\n') do "$tool"/local/runit-sv-configure "$sv" "$@" "$tool"/local/runit-sv-start "$sv" done #sleep 3 #sudo find -L /etc/service -type l -delete fi