Results 1 to 9 of 9

Thread: Start restart stop game servers

  1. #1
    Private First Class thOuMta's Avatar
    Join Date
    Oct 2012
    Location
    France
    Posts
    191
    Thanks
    139
    Thanked 35 Times in 28 Posts

    Start restart stop game servers

    Hi,

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

    Thanks.

  2. #2
    Private First Class YuriJurek's Avatar
    Join Date
    Jun 2013
    Posts
    219
    Thanks
    152
    Thanked 88 Times in 47 Posts
    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.

  3. The Following User Says Thank You to YuriJurek For This Useful Post:

    thOuMta (3rd September 2013)

  4. #3
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    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

  5. The Following User Says Thank You to RobsoN For This Useful Post:

    YuriJurek (3rd September 2013)

  6. #4
    Private First Class YuriJurek's Avatar
    Join Date
    Jun 2013
    Posts
    219
    Thanks
    152
    Thanked 88 Times in 47 Posts
    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...

  7. #5
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Connect with PHP/SSH2 and then execute your start/stop-script (which work with screen)
    timescale 0.01

  8. #6
    Private First Class thOuMta's Avatar
    Join Date
    Oct 2012
    Location
    France
    Posts
    191
    Thanks
    139
    Thanked 35 Times in 28 Posts
    My start script:

    PHP Code:
    cd /home/cod2server/
    screen ----S cod2server ./cod2_lnxded +set fs_game main +exec server.cfg +map_rotate +set net_port 28960 +set sv_maxclients 16 
    My restart script:

    PHP Code:
    cd /home/cod2server/
    ./
    stop.sh
    ./start.sh 
    My stop script:

    PHP Code:
    screen -S cod2server -X quit 
    And from the web:

    PHP Code:
    <a href="/start.php">Start CoD2</a>
    <
    a href="/restart.php">Restart CoD2</a>
    <
    a href="/stop.php">Stop CoD2</a
    PHP Code:
    <?php
    shell_exec
    ('cd /home/cod2server/ && ./start.sh');
    ?>

    etc.. in other files
    Its only start servers.

  9. The Following User Says Thank You to thOuMta For This Useful Post:

    YuriJurek (4th September 2013)

  10. #7
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    You really need PHP/SSH2 for user-based screen sessions (I guess your stop-script works then also).
    timescale 0.01

  11. #8
    Private First Class thOuMta's Avatar
    Join Date
    Oct 2012
    Location
    France
    Posts
    191
    Thanks
    139
    Thanked 35 Times in 28 Posts
    No stop script don't work, that make new folder

  12. #9
    Corporal STAUFFi's Avatar
    Join Date
    Aug 2012
    Location
    Germany
    Posts
    269
    Thanks
    106
    Thanked 128 Times in 83 Posts
    Code:
    $stauffi = shell_exec("sudo -u ".$username ." /pfad to gamefolder /start.sh stop");
    ??
    Last edited by STAUFFi; 5th September 2013 at 21:14.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •