Added function scripts

pull/1/head
Aaron Johnson 7 years ago
parent af66d5ff7b
commit 047ae54176

@ -0,0 +1,2 @@
ssh ajohnson@tartarus srvstart.bat

@ -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

@ -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

@ -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 <<EOF
#$pass
#say 'This is a test.'
#^]
#EOF
#
#exit 0
Loading…
Cancel
Save