Hi,
Do its possible can i make start/restart/stop game servers from my website.
I don't mean a game panel.
Thanks.
Hi,
Do its possible can i make start/restart/stop game servers from my website.
I don't mean a game panel.
Thanks.
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.
thOuMta (3rd September 2013)
Sure, use ssh extension in php:
PHP Code:
shell_exec('cd /home/cod2 && ./start.sh');
"Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right
YuriJurek (3rd September 2013)
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...
Connect with PHP/SSH2 and then execute your start/stop-script (which work with screen)
timescale 0.01
My start script:
My restart script:PHP Code:
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 stop script:PHP Code:
cd /home/cod2server/
./stop.sh
./start.sh
And from the web:PHP Code:
screen -S cod2server -X quit
PHP Code:
<a href="/start.php">Start CoD2</a>
<a href="/restart.php">Restart CoD2</a>
<a href="/stop.php">Stop CoD2</a>
Its only start servers.PHP Code:
<?php
shell_exec('cd /home/cod2server/ && ./start.sh');
?>
etc.. in other files
YuriJurek (4th September 2013)
You really need PHP/SSH2 for user-based screen sessions (I guess your stop-script works then also).
timescale 0.01
No stop script don't work, that make new folder
??Code:$stauffi = shell_exec("sudo -u ".$username ." /pfad to gamefolder /start.sh stop");
Last edited by STAUFFi; 5th September 2013 at 21:14.