Jump to content

Need some help Windows to Linux


Aimless

Recommended Posts

Can someone please tell me what this code:

	private function Run($sCommand)
{
	require('auth.php');
	require('GetServer.php');
	$sCommand = 'cmd /C '.$sCommand;
	$oShell = new COM("WScript.Shell");
	$oShell->Run($sCommand, 0, false);
	return true;
}
public function Start()
{
	require('auth.php');
	require('GetServer.php');
	$this->Run('start /D "'.GAME_DIRECTORY.'" /B '.GAME_BIN_NAME);
	return true;
}
public function Stop()
{
	require('auth.php');
	require('GetServer.php');
	$this->Run('taskkill /F /IM '.GAME_BIN_NAME.' /T');
	return true;
}

would be for Linux, this is working fine to Start and Stop applications on Windows but of course not for Linux as I need to change some of the code, but I'm not sure what to change.

 

All help very much appreciated.

Link to comment
Share on other sites

Hi,

 

Thanks but no luck.

	public function Start()
{
	require('auth.php');
	require('GetServer.php');
	//$this->Run('start /D "'.GAME_DIRECTORY.'" /B '.GAME_BIN_NAME);
        popen("/samp/samp", "r");


//	return true;
}

popen("/samp/samp", "r");

It's not doing anything!

 

Can someone tell me how to start an application in linux, my application is located at /samp/samp, an example on how to start it will do

Link to comment
Share on other sites

$command = './buttons';
  
  $command = $commandJob.' > /dev/null 2>&1 & echo $!';
  exec($command ,$op);
  $pid = (int)$op[0];

  if($pid!="") {
      sleep(4);
      
      exec("kill -9 $pid", $output); 
  }

 

'buttons' is an executable in my current folder. Replace it with your path

Link to comment
Share on other sites

Are you sure I have to read it, can someone provide me an example of this?

I'm sorry. This is a specific thing. Of course, you should not always read it. exec() with Linux shell command pipe tricks will do the job.

I thought of another stuff when posted the reply.

Link to comment
Share on other sites

This may not be appropriate but I haven't had any luck with what you guys have kindly suggested, so if anyone can make those three little segments of code in the original post I will PayPal them $3 as thanks, please PM or MSN me(trunetworkenquiries@gmail.com) if you can do it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.