diff --git a/srvstart b/srvstart new file mode 100755 index 0000000..db1e43d --- /dev/null +++ b/srvstart @@ -0,0 +1,2 @@ +ssh ajohnson@tartarus srvstart.bat + diff --git a/srvstatus b/srvstatus new file mode 100755 index 0000000..3c4df63 --- /dev/null +++ b/srvstatus @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +host=$1 +port=$2 +pass=$3 + +if nc -zvw3 $host $port 2>/dev/null; then + ./srvstatus.expect $host $port $pass > /tmp/.stat + grep -B1 -A8 Empyrion\ dedicated\ server /tmp/.stat | egrep -v Playfield\|Game\ seed + echo "\nOnline players:\n- - - - - - - - - - - - - -" + sed -n '/Global\ online/,/Global\ players/p' /tmp/.stat | awk -F\= '{print $3}' | sed 's/....$//' + rm /tmp/.stat + exit 0 +else + echo "Server is DOWN!" + exit 1 +fi + diff --git a/srvstatus.expect b/srvstatus.expect new file mode 100755 index 0000000..db9b981 --- /dev/null +++ b/srvstatus.expect @@ -0,0 +1,14 @@ +#!/usr/bin/expect + +set timeout 10 +set host [lindex $argv 0] +set port [lindex $argv 1] +set pass [lindex $argv 2] + +spawn telnet $host $port +expect "password:" +send "$pass\r" +expect "Logged in successfully" +send "plys\r" +expect eof + diff --git a/srvstop b/srvstop new file mode 100755 index 0000000..224ef68 --- /dev/null +++ b/srvstop @@ -0,0 +1,28 @@ +#!/usr/bin/expect + +set timeout 10 +set host [lindex $argv 0] +set port [lindex $argv 1] +set pass [lindex $argv 2] + +spawn telnet $host $port +expect "password:" +send "$pass\r" +expect "Logged in successfully" +send "say 'This is a test (shutdown command) (no, it is not actually shutting down, hence the test).'\r" +expect eof + + +##!/usr/bin/env sh +#host=$1 +#port=$2 +#pass=$3 +# +#telnet $host $port <