PHP Start
#1

Code:
	private function Run($sCommand)
	{
		require('auth.php');
		require('GetServer.php');
		shell_exec('cd /var/www/sampservers/s1');
    shell_exec('./samp02Xsvr');
		shell_exec('cd'.GAME_DIRECTORY.'');
		shell_exec('nohup'.GAME_BIN_NAME.'&');
		exec('nohup'.GAME_BIN_NAME.'&');
		$sCommand = 'cmd /C '.$sCommand;
		$oShell = new COM("WScript.Shell");
		$oShell->Run($sCommand, 0, false);
		$aTemp = array();
    proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp));
		return true;
	}
Code:
	public function Start()
	{
		require('auth.php');
		require('GetServer.php');
		shell_exec('cd /var/www/sampservers/s1');
    shell_exec('./samp02Xsvr');
		shell_exec('cd'.GAME_DIRECTORY.'');
		shell_exec('nohup'.GAME_BIN_NAME.'&');
		exec('nohup'.GAME_BIN_NAME.'&');
		$this->Run('start /D "'.GAME_DIRECTORY.'" /B '.GAME_BIN_NAME);
$aTemp = array();
proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp));
		return true;
	}
Code:
	public function Stop()
	{
		require('auth.php');
		require('GetServer.php');
		$this->Run('taskkill /F /IM '.GAME_BIN_NAME.' /T');
		return true;
	}
I'm trying to start the server.

Here's what I've got so far but it does not seem to start the server, it's a variation of Nitok's Starter code (http://forum.sa-mp.com/index.php?topic=138092.0) - I took the Windows version of the code and add bits into it to see if I could start SA-MP on a linux server but.. phail.

Any help...?
Reply
#2

Technically it's a variation of my code, but oh well.

You would need separate scopes for Linux and Windows (Linux doesn't have the COM object). And don't use shell_exec();


...and I don't appreciate people adding my MSN without asking.
Reply
#3

If I can't use shell_exec() what function do I use to start the server?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)