#!/bin/zsh
die() {
	echo "$@"
	exit 1
}
D=${1:a}
shift
[[ -d $D ]] || die "Not a directory: $1"
PID=$D/runsvdir.pid
[[ -f $PID ]] && kill -0 $(<$PID) &>/dev/null && die "runsvdir already running in $SVCDIR"
echo $$ >$PID
exec runsvdir $D "$@"