|
|
 |
|
|
Pages: 1
Server status for your team speak server with bash & expect
(Click here to view the original thread with full colors/images)
Posted by: BooRadley
First a database querry script:
Code:
[root@valerie cgi-bin]# more whoson
#!/usr/bin/expect
spawn telnet localhost 51234
expect "\[TS\]"
send "pl 8767\r"
expect "OK"
send "quit"
exit
Then we can use that in a status check in ../cgi-bin/tss.cgi:
Code:
[root@valerie cgi-bin]# more tss.cgi
#!/bin/bash
echo "Content-type: text/plain"
echo ""
echo ""
food=$(ps -ef | grep tss2 | grep -v grep | grep -v cgi-bin)
if [[ $food = "" ]]
then
echo "The Team Speak server isn't running."
else
echo "The Team Speak server is up and running"
echo ""
echo "Currently active users:"
echo ""
./whoson | grep "\"" | awk '{ print $15 " aka " $16 }'
fi
Assuming you alter permissions for your TSS directory to allow user apache to write, then you can use:
Code:
#!/bin/bash
echo "Content-type: text/plain"
echo ""
echo ""
food=$(ps -ef | grep tss2 | grep -v grep | grep -v cgi-bin)
if [[ $food = "" ]]
then
echo "server wasn't running. Starting it."
/home/booradley/tss2_rc2/teamspeak2-server_startscript start
else
echo "server was running already on:"
echo $food
fi
. . . and link it on the web admin page so, in a crunch, one of your team speak admins can start the server if it's stopped for some reason.
Use at your own risk.
|
|
|
|
|