=== modified file 'ssh-slave' --- ssh-slave 2013-05-15 21:13:18 +0000 +++ ssh-slave 2013-05-09 11:23:12 +0000 @@ -32,19 +32,14 @@ [[ $master_path != */.ssh/master-* ]] && die master path $master_path failed sanity check svdir=${master_path:h}/service svname=${master_path:t} - s=$svdir/$svname - mkdir -p $s - print -r - 'args=(' ${(q)@} ')' >$s/args - touch $s/down - [[ -a $s/run ]] && rm $s/run - ln -s ${commands[sv.ssh-master.run]} $s/run - [[ -a $s/check ]] && rm $s/check - ln -s ${commands[sv.ssh-master.check]} $s/check - if [[ -o xtrace ]]; then - zsh -x ${commands[usv.bg]} $svdir || die - else - usv.bg $svdir || die - fi - sv start $s || die + mkdir -p $svdir/$svname + print -r - 'args=(' ${(q)@} ')' >$svdir/$svname/args + touch $svdir/$svname/down + [[ -a $svdir/$svname/run ]] && rm $svdir/$svname/run + ln -s ${commands[sv.ssh-master.run]} $svdir/$svname/run + [[ -a $svdir/$svname/check ]] && rm $svdir/$svname/check + ln -s ${commands[sv.ssh-master.check]} $svdir/$svname/check + usv.bg $svdir || die + sv start $svdir/$svname || die fi exec ssh $noconnect "$@" === modified file 'sv.ssh-master.run' --- sv.ssh-master.run 2013-05-15 21:13:18 +0000 +++ sv.ssh-master.run 2013-05-04 12:54:56 +0000 @@ -1,19 +1,4 @@ #!/bin/zsh - autoload find_ssh_agent; find_ssh_agent source ./args - -# check for already running master or stale socket -check="$( command ssh -O check "$args[@]" 2>&1 )" -if (($?)); then - for line in ${(f)check}; do - if [[ $line == 'Control socket connect('* ]]; then - master_path=${${check%)*}#*\(} - fi - done - [[ -a $master_path ]] && rm $master_path -else - command ssh -O exit "$args[@]" -fi - exec ssh -v -y -o ControlMaster=yes -o BatchMode=yes -N "${args[@]}" === modified file 'usv.bg' --- usv.bg 2013-05-15 21:13:18 +0000 +++ usv.bg 2013-05-09 11:23:12 +0000 @@ -1,9 +1,8 @@ #!/bin/zsh D=${1:-~/service} [[ -d $D ]] || { echo 'invalid service directory:' $D; exit 1 } -touch $D/lock if [[ -o xtrace ]]; then - exec flock -w 5 $D/lock zsh -x ${commands[usv.bg_locked]} "$@" + exec flock -w 5 $D zsh -x ${commands[usv.bg_locked]} "$@" else - exec flock -w 5 $D/lock usv.bg_locked "$@" + exec flock -w 5 $D usv.bg_locked "$@" fi