autofly: fix regression
[waspsaliva.git] / automt
blob2221fadeec3f424cc9bfee06f9cd5e989c222c24
1 #!/bin/sh
2 if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then echo "usage: automat server username password"; exit 1; fi
3 pwf=~/.mtpw
4 srv=$1
5 prt=30000
6 usr=$2
7 pas=$3
8 logfile=$HOME/.wslog
9 mtpath=$(dirname $0)
10 if [ -f $pwf ]; then pas=$(cat $pwf); fi
11 check_host() {
12 if [ ! -x $(which nc) ]; then return 0; fi
13 if nc -z $1 $2; then return 0; fi
14 return 1
17 while true; do
18 if check_host $srv $prt; then
19 $mtpath/bin/minetest --go --address $srv --name $usr --password $pas --logfile $logfile
20 else echo host is down. waiting 10...; sleep 10
22 done