Restarting server via web.

machine

Well-Known Member
Ok so I have been trying to figure out how to allow my admins to restart the server over the web. I have tried.

Code:
<?php
if(isset($_POST['submit']))
{
echo exec('restart.bat');
echo "Done!";
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="DO IT!">
</form>
<?php
}
?>

-AND-

Code:
<?php
if(isset($_POST['submit']))
{
echo exec("Psexec.exe -i -d  restart.bat");
echo "Done!";
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="DO IT!">
</form>
<?php
}
?>

I need the .bat file executed because it does all the server maintenance / clean up / respawn vehicles etc. I really think i am just looking at this the wrong way... hoping someone can point me in the right direction.
 
Try to provide an absolute path to the bat file. Also, I'm not even sure how well exec works in your situation. I've never used the function myself (that's coming from someone who has 4 years experience in PHP)

Also, why not just use a control panel? Saves time and saves you from a headache. If you specificly want this setup, I think you'd spend your time better asking on Stackoverflow and not here.
 
what about a webinterface? =)
windows? linux?

or if it only should be a restart of the running server (restart script needed though) the shutdown command per rcon would be enough maybe?
 
Running windows. dayz cc / with reality.

I found a "restart on crash" program and I will be using that for now. This way the admins can use BEC to #shutdown and the "restart on crash" will run the .bat file.
 
Seems not to be a reliable method, but if it floats your boat I guess..

As I said, why not use a dayz cc or reality web control panel? They're available on here or on the specified packages' forums.
 
I have dayzcc the problem is when my admins press "restart" "start" or "stop" the server does not use my custom start up file "serverstart.bat" which cleans the logs, respawns vehicles, removes dead players, removes vehicles untouched for more than 3 days, starts BEC (i use bec for auto retsrats). Sooo what i needed was a way for the admins to instead execute the serverstart.bat without having remote access to the dedicated box.
 
Seems not to be a reliable method, but if it floats your boat I guess..

As I said, why not use a dayz cc or reality web control panel? They're available on here or on the specified packages' forums.
why shouldnt this be a reliable method?
i start my server on linux with a restart loop which restarts the whole process if crashed or killed without killing the screen its running in...
it works 100%
and i have the db scripts and bec also included in this startup process
 
I also just realized i can give my admins the ability to use bec to run the .bat file *head hits keyboard* I knew i was over thinking it. Anyway at least now with this program should the server ever crash with no one around it will reboot itself.

If anyone else on windows would like this program you can find it here (I have nothing to do with it and can not help support it): http://www.dayzcc.tk/index.php?page=Thread&postID=22087&highlight=RESTART+BEC#post22087
 
Back
Top