From d7a44e2f7a75725d3be341f8934aef9b7769c45a Mon Sep 17 00:00:00 2001 From: mathiascode Date: Tue, 17 Mar 2020 05:59:15 +0200 Subject: [PATCH] Further improvements to alive checker --- script/alivecheck.sh | 2 +- script/init.sh | 1 - script/proxy.sh | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/script/alivecheck.sh b/script/alivecheck.sh index 7808259..033f5c8 100755 --- a/script/alivecheck.sh +++ b/script/alivecheck.sh @@ -16,7 +16,7 @@ while true; do if [ "$(env printf '\xFE' | nc -w 15 play.kaboom.pw 25565 | wc -m)" -eq 0 ]; then pkill -9 java - kill -9 `cat $AUTOSSH_PIDFILE` + kill -9 $PROXY_PID echo $(date) >> kill.log fi #fi diff --git a/script/init.sh b/script/init.sh index b0bed9a..e286428 100755 --- a/script/init.sh +++ b/script/init.sh @@ -3,7 +3,6 @@ # This is the core script that Heroku uses when booting up a dyno PATH="$HOME/autossh/bin/:$HOME/dtach/bin/:$HOME/java/bin/:$PATH" -export AUTOSSH_PIDFILE=$HOME/autossh.pid # Set up SSH for proxy server and schematics repository # Load keys from environmental variables diff --git a/script/proxy.sh b/script/proxy.sh index 410b9c8..d9f0049 100755 --- a/script/proxy.sh +++ b/script/proxy.sh @@ -7,14 +7,12 @@ set -x while true; do - autossh -M 0 \ - -o "ServerAliveInterval 30" \ - -o "ServerAliveCountMax 3" \ - -i ~/.ssh/proxy \ + ssh -i ~/.ssh/proxy \ -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o StreamLocalBindUnlink=yes \ -c aes128-ctr \ -C -S none -N -T -R \ 25565:localhost:25565 \ remote@play.kaboom.pw + export PROXY_PID=$! sleep 1 done