PDA

View Full Version : Start restart stop game servers



thOuMta
3rd September 2013, 00:28
Hi,

Do its possible can i make start/restart/stop game servers from my website.
I don't mean a game panel.

Thanks.

YuriJurek
3rd September 2013, 21:58
Yes sure, it is possible. But as how to make such a thing I am not able to tell you sorry, and by the way I'am looking for such solution as well, just a simple Start, Stop, Restart, and maybe game log output view on my website, and it would be really great if someone would tell how to make sure it is secure for example make it password protected or a session protected.

RobsoN
3rd September 2013, 22:12
Sure, use ssh extension in php:


shell_exec('cd /home/cod2 && ./start.sh');

YuriJurek
3rd September 2013, 22:44
Well yes and no, I've heard it executes files as the web user so if I want to execute cod I would need to give it all the permissions needed to do so, but I'll try it anyway later on.

And what about login session, I've tried a lot of things but none of them worked as I expected...

kung foo man
4th September 2013, 03:08
Connect with PHP/SSH2 and then execute your start/stop-script (which work with screen)

thOuMta
4th September 2013, 13:34
My start script:


cd /home/cod2server/
screen -A -m -d -S cod2server ./cod2_lnxded +set fs_game main +exec server.cfg +map_rotate +set net_port 28960 +set sv_maxclients 16

My restart script:


cd /home/cod2server/
./stop.sh
./start.sh

My stop script:


screen -S cod2server -X quit

And from the web:



<a href="/start.php">Start CoD2</a>
<a href="/restart.php">Restart CoD2</a>
<a href="/stop.php">Stop CoD2</a>




<?php
shell_exec('cd /home/cod2server/ && ./start.sh');
?>

etc.. in other files


Its only start servers.

kung foo man
4th September 2013, 14:38
You really need PHP/SSH2 for user-based screen sessions (I guess your stop-script works then also).

thOuMta
4th September 2013, 15:18
No stop script don't work, that make new folder :)

STAUFFi
5th September 2013, 22:11
$stauffi = shell_exec("sudo -u ".$username ." /pfad to gamefolder /start.sh stop"); ??