=== modified file 'ssh-slave' --- ssh-slave 2013-05-09 11:23:12 +0000 +++ ssh-slave 2013-05-04 12:54:56 +0000 @@ -10,26 +10,9 @@ -o KbdInteractiveAuthentication=no ) -# prevent logging to syslog instead of stderr -filtered=() -for arg in "$@"; do - case $arg in - (--*) filtered+=$arg;; - (-y);; - (-*) filtered+=${arg/y/};; - (*) filtered+=$arg;; - esac -done - -check="$( ssh -O check "$filtered[@]" 2>&1 )" +check="$( ssh -O check "$@" 2>&1 )" if (($?)); then - for line in ${(f)check}; do - if [[ $line == 'Control socket connect('* ]]; then - master_path=${${check%)*}#*\(} - fi - done - [[ -z $master_path ]] && die 'could not determine master path' - [[ $master_path != */.ssh/master-* ]] && die master path $master_path failed sanity check + master_path=${${check%)*}#*\(} svdir=${master_path:h}/service svname=${master_path:t} mkdir -p $svdir/$svname === removed file 'svs' --- svs 2013-05-09 11:23:12 +0000 +++ svs 1970-01-01 00:00:00 +0000 @@ -1,2 +0,0 @@ -#!/bin/zsh -for pid in $(pgrep runsvdir); do a=( ${(0)"$(&1 | logger -t svdir.${D:t} &! + while ! usv.check $D; do + CSEC_WAIT=$(( CSEC_WAIT - 1 )) + sleep '0.01s' + if ! (($CSEC_WAIT)); then + print >&2 "failed to spawn runsvdir in: $D" + exit 1 + fi + done fi === removed file 'usv.bg_locked' --- usv.bg_locked 2013-05-09 11:23:12 +0000 +++ usv.bg_locked 1970-01-01 00:00:00 +0000 @@ -1,19 +0,0 @@ -#!/bin/zsh -D=${1:-~/service} -[[ -d $D ]] || { echo 'invalid service directory:' $D; exit 1 } -DSEC_WAIT=10 -if [[ -o xtrace ]]; then - usv.check() { zsh -x ${commands[usv.check]} "$@" } -fi -if ! usv.check $D; then - setsid usv.run $D 2>&1 | logger -t svdir.${${D:t}##.} &! - while ! usv.check $D; do - DSEC_WAIT=$(( DSEC_WAIT - 1 )) - sleep '0.1s' - if ! (($DSEC_WAIT)); then - print >&2 "failed to spawn runsvdir in: $D" - exit 1 - fi - done -fi - === modified file 'usv.check' --- usv.check 2013-05-09 11:23:12 +0000 +++ usv.check 2013-05-04 16:30:11 +0000 @@ -1,4 +1,4 @@ #!/bin/zsh PID=$1/runsvdir.pid -[[ -d $1 ]] && [[ -f $PID ]] && kill -0 $(<$PID) &>/dev/null +[[ -d $1 ]] && [[ -f $PID ]] && kill -0 $(<$PID) exit $? === removed file 'usv.logger' --- usv.logger 2013-05-09 11:23:12 +0000 +++ usv.logger 1970-01-01 00:00:00 +0000 @@ -1,2 +0,0 @@ -#!/bin/zsh -exec logger -t ${PWD:h:t} === modified file 'usv.run' --- usv.run 2013-05-09 11:23:12 +0000 +++ usv.run 2013-05-04 12:54:56 +0000 @@ -3,10 +3,8 @@ 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" +[[ -d $1 ]] || die "Not a directory: $1" +PID=$1/runsvdir.pid +[[ -f $PID ]] && kill -0 $(<$PID) && die "runsvdir already running in $SVCDIR" echo $$ >$PID -exec runsvdir $D "$@" +exec runsvdir "$@" === removed file 'usv.stop' --- usv.stop 2013-05-09 11:23:12 +0000 +++ usv.stop 1970-01-01 00:00:00 +0000 @@ -1,22 +0,0 @@ -#!/bin/zsh -die() { - echo "$@" >/dev/null - exit 1 -} - -PID=$1/runsvdir.pid - -[[ -d $1 ]] || die "Not a directory: $1" -[[ -f $PID ]] || die "runsvdir does not appear to be running in $1" - -for r in $1/**/run; do - sv down ${r:h} -done - -# wait for termination -for r in $1/**/run; do - sv stop ${r:h} -done - -kill $(<$PID) -