PDA

View Full Version : Web based restart script


Khundawg
10-11-2005, 06:04
Hey all. I have recently moved from paying for TS hosting to hosting my own server. My old host had a nifty "Restart Server" link in their web based control panel. Are there any scripts available on the forums to do this? I tried searching and found a few threads on setting up cron jobs but I would really rather have a simple link I could give to my admins to click if they see the server is down.

Thanks in advance!

marcelrx
10-11-2005, 11:40
Hey all. I have recently moved from paying for TS hosting to hosting my own server. My old host had a nifty "Restart Server" link in their web based control panel. Are there any scripts available on the forums to do this? I tried searching and found a few threads on setting up cron jobs but I would really rather have a simple link I could give to my admins to click if they see the server is down.

Thanks in advance!

What do you want. I think you only want to restart a special virtual server. Not the whole teamspeak service. If you want to restart the whole service you can use cron. But if you want to restart,stop or start a virtual server you can use telnet. You can use PHP or Perl and make a Socket Connection the the TcPQuery port. If you want use php this will help you. http://cyts.midlink.org

Khundawg
10-11-2005, 15:59
Well, I would actually like to restart the service as it seems that when a server crashes, it often needs a full restart. I have seen the cron scripts and I am not in love with the idea of setting a cron that runs every 5 minutes or 10 minutes or whatever. I would much rather be able to have a "one click" solution. Is this possible?

siepel
12-11-2005, 02:25
If u have a host that has apache / php enabled, u could use the function exec() from php to execute a perl /bash script.

that script could restart the server.

But i dont know why u would ever want to restart it. Normally if u have TS running, it can run for many years.

Making a clickable link, does cost some time. If you login with ssh to restart the server by hand, it would take less time.

Khundawg
14-11-2005, 03:52
Ok, I got the restart cron working for the server. Now I need a restart for the virtual server. I am trying to get the info marcelrx posted working but not having much luck. I am a novice at php at best and using the objects is a little above me.

The reason I want to have a web based restart is because I run a TS server for a Warcraft guild I am not very active in anymore. I dont want to give anyone superadmin (thats just too much power) but I want to let them have the ability to restart the server when it crashes, which is quite often.

Any help you guys can provide is much appreciated!

Khundawg
14-11-2005, 05:09
Heres what I have so far, please dont be too harsh:


<?php
include("cyts.class.php");


$sIP = "IP"; //The server's IP-Adress
$sTCP = 14534; //The server's TCP-Queryport
$sTimeout = 20; //Socket timeout in seconds
$sUser = "user";
$sPass = "pass";
$sID = 2;



$1 = connect($sIP, $sTCP, $sUDP = false, $sTimeout);
if($1 == "true"){
echo "<h2>Connected to server.</h2><br>";
$2 = slogin($sUser, $sPass);
if($2 == "true"){
echo "<h2>Login successful.</h2><br>";
$3 = sadmin_dbServerInfo($sID, $sList=false);
$4 = sadmin_serverStop();
$5 = sadmin_serverStart($sID);
if($3 == "true" && $4 == "true" && $5 == "true"){
echo "<h2>Server Restarted.</h2>";
}
else{
echo "<h2>Server Not Restarted</h2>";
}
else{
echo "<h2>Login unsuccessful.</h2><br>";
}
else{
echo "Could not connect to server.";
}

?>


I know this doesnt work and is messed up. Once again, any help is much appreciated.

Thanks!