Jump to content

[SOLVED] system command


AV1611

Recommended Posts

That worked just as expected.

 

I've got 2 final minor problems.

 

1.

 

When I issue the exec() to start the server, it starts perfectly but the browser never gets any info so it sits with an hourglass and never times out or whatever.  You can close the browser ok, but that's kinda annoying.  Suggestions?  I put an echo success at the end of the clause but it never get's to it.  Suggestions?

 

2.

 

The stop worked flawlessly.  I need to modify that to some kind of check to see if the server is already started before trying to start it... I can handle the clauses, I just could use some help with the $var made from the exec() to see if it is running already.  Hope that makes sense.

 

 

BTW

<?php

if(!isset($_GET['run']))

{

    echo'

    <a href="server3.php?run=start">Start Game Server</a><br />

    <a href="server3.php?run=stop">Stop Game Server</a><br />

    ';

    die('You must specify an option');

}

if($_GET['run']=="start")

    {

    set_time_limit(3); //<--- did not help

    chdir('/home/aops-lnxded-2.8.1/System');

    exec('/home/aops-lnxded-2.8.1/System/server-bin GLOBAL sniper_range.aao -nohomedir ini=server.ini &');

    echo 'Server Started...'; //<--- never get here

    }

elseif($_GET['run']=="stop")

    {

    exec('kill -9 $(ps -C server-bin | grep server-bin | awk "{print $1}")');

    }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.