add more debug detail

This commit is contained in:
Gordon Grant-Stuart 2023-02-22 16:20:50 +00:00
parent 4d35eeae37
commit 91110e4a6e

View File

@ -45,6 +45,7 @@ function connect () {
case "$1" in
FORKSTART )
# echo -n $$ > "$BASEDIR/var/${2}.connected"
$0 FORKWATCH $2 '#tunnelkeeper' &
if [[ $(grep -c "^$2" $PWCONF) -gt 0 ]]; then
pass=$(awk "/^$2/ {print \$2}" ${PWCONF}) # password needed
screen -d -m -S "tk${2}" $0 FORKSCREEN $2 '#tunnelkeeper'
@ -64,16 +65,18 @@ case "$1" in
sleep 5
done
fi
$0 FORKWATCH $2 '#tunnelkeeper' &
exit
;;
FORKWATCH ) # makes sure the connection is still working, even if ssh doesn't drop it
while true; do
sleep $TIMEOUT
echo "tick $2" | dbg
if [[ $(timeout $TIMEOUT ssh localhost -S $BASEDIR/var/$2.tksock "echo tk") != "tk" ]]; then
ssh localhost -O exit -S $BASEDIR/var/$2.tksock
echo "Killing connection to $2. Trying again." | dbg
fi
done
exit
;;
FORKSCREEN )
# while [[ -e "$BASEDIR/var/${2}.connected" ]]; do