You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
empyrion-bot/scripts/srvstatus

19 lines
480 B

#!/usr/bin/env sh
host=$1
port=$2
pass=$3
if nc -zvw3 $host $port 2>/dev/null; then
./scripts/srvstatus.expect $host $port $pass > /tmp/.stat
grep -B1 -A8 Empyrion\ dedicated\ server /tmp/.stat | egrep -v Playfield\|Game\ seed
printf "\nOnline players:\n- - - - - - - - - - - - -"
sed -n '/Global\ online/,/Global\ players/p' /tmp/.stat | awk -F\= '{print $3}' | sed 's/....$//'
rm /tmp/.stat
exit 0
else
printf "Server is not responding to telnet requests!"
exit 1
fi