Browse Source

make rescue work, fix stopping... make script work in /etc and /usr/local/etc

remotes/client/ssh-main
John-Mark Gurney 4 years ago
parent
commit
02ef0d100e
1 changed files with 12 additions and 6 deletions
  1. +12
    -6
      ggatessh/rc.d/ggatessh

+ 12
- 6
ggatessh/rc.d/ggatessh View File

@@ -22,6 +22,8 @@ tests_cmd="ggatessh_tests"
extra_commands="destroy rescue status tests" extra_commands="destroy rescue status tests"
required_modules="geom_gate:g_gate" required_modules="geom_gate:g_gate"


command="${0%/etc/rc.d/ggatessh}/sbin/ggatessh"

# ggatessh_devs="0 2 3" # ggatessh_devs="0 2 3"
# ggatessh_0_path="remuser@host.example.com:somepath" # ggatessh_0_path="remuser@host.example.com:somepath"
# ggatessh_0_pidfile="xxx" # ggatessh_0_pidfile="xxx"
@@ -67,7 +69,7 @@ parse_path()
ggatessh_destroy() ggatessh_destroy()
{ {
echo destroying ggate$devnum echo destroying ggate$devnum
ggatessh destroy -u "$devnum"
${command} destroy -u "$devnum"
} }


ggatessh_run() ggatessh_run()
@@ -85,7 +87,7 @@ ggatessh_run()
args="$args -p $(getvar port)" args="$args -p $(getvar port)"
fi fi


ggatessh "$1" $args -l "$user" -u "$devnum" "$host" "$imgpath"
${command} "$1" $args -l "$user" -u "$devnum" "$host" "$imgpath"
} }


ggatessh_rescue() ggatessh_rescue()
@@ -106,11 +108,12 @@ ggatessh_stop()
if [ x"$pid" != x"" ]; then if [ x"$pid" != x"" ]; then
echo "killing ggatessh ggate$devnum pid $pid" echo "killing ggatessh ggate$devnum pid $pid"
while :; do 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 fi
echo .
sleep .5
done done
else else
echo "error ggatessh $devnum not running" echo "error ggatessh $devnum not running"
@@ -170,6 +173,7 @@ ggatessh_tests()
fi fi




command=ggatessh
ggatessh() ggatessh()
{ {
if [ x"$*" != x"$expected" ]; then if [ x"$*" != x"$expected" ]; then
@@ -223,6 +227,8 @@ ggatessh_iter()
ggatessh_start ggatessh_start
elif [ x"$1" = x"stop" ]; then elif [ x"$1" = x"stop" ]; then
ggatessh_stop ggatessh_stop
elif [ x"$1" = x"rescue" ]; then
ggatessh_rescue
elif [ x"$1" = x"status" ]; then elif [ x"$1" = x"status" ]; then
ggatessh_status ggatessh_status
fi fi


Loading…
Cancel
Save