diff --git a/ggatessh/rc.d/ggatessh b/ggatessh/rc.d/ggatessh index fa1063d..57e9547 100644 --- a/ggatessh/rc.d/ggatessh +++ b/ggatessh/rc.d/ggatessh @@ -22,6 +22,8 @@ tests_cmd="ggatessh_tests" extra_commands="destroy rescue status tests" required_modules="geom_gate:g_gate" +command="${0%/etc/rc.d/ggatessh}/sbin/ggatessh" + # ggatessh_devs="0 2 3" # ggatessh_0_path="remuser@host.example.com:somepath" # ggatessh_0_pidfile="xxx" @@ -67,7 +69,7 @@ parse_path() ggatessh_destroy() { echo destroying ggate$devnum - ggatessh destroy -u "$devnum" + ${command} destroy -u "$devnum" } ggatessh_run() @@ -85,7 +87,7 @@ ggatessh_run() args="$args -p $(getvar port)" fi - ggatessh "$1" $args -l "$user" -u "$devnum" "$host" "$imgpath" + ${command} "$1" $args -l "$user" -u "$devnum" "$host" "$imgpath" } ggatessh_rescue() @@ -106,11 +108,12 @@ ggatessh_stop() if [ x"$pid" != x"" ]; then echo "killing ggatessh ggate$devnum pid $pid" while :; do - pkill -L -F $(getpidfile) -q - if ! getpid >/dev/null; then - echo . - sleep .5 + pkill -L -F $(getpidfile) + if [ x"$(getpid)" = x"" ]; then + break fi + echo . + sleep .5 done else echo "error ggatessh $devnum not running" @@ -170,6 +173,7 @@ ggatessh_tests() fi + command=ggatessh ggatessh() { if [ x"$*" != x"$expected" ]; then @@ -223,6 +227,8 @@ ggatessh_iter() ggatessh_start elif [ x"$1" = x"stop" ]; then ggatessh_stop + elif [ x"$1" = x"rescue" ]; then + ggatessh_rescue elif [ x"$1" = x"status" ]; then ggatessh_status fi