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