msknight Posted January 11, 2007 Share Posted January 11, 2007 Same problem as a post a few months ago, but a different cause.I write tools to support people running L2J servers, and I have a problem ...The script detects whether the gameserver is down, and if it is, then it it tasked with restarting it.The program correctly executes the script, which contains a command ...#! /bin/sh./GameServer_loop.sh &.... which then calls a looping .sh file.The issue of this is that, of course, the whole thing never ends and even if I shut down the gameserver, the program hangs ... presumably waiting for some return from the command so that the script can continue executing.This, obviously, won't happen.What I need is a way of running a system command, and telling the PHP script not to bother waiting for a response ... just continue running.Any ideas please? Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Let your shell script run in a loop completely seperate from php (ie start it from the shell) and write its output to a file. You can then use php to read this file whenever you need to. Quote Link to comment Share on other sites More sharing options...
msknight Posted January 11, 2007 Author Share Posted January 11, 2007 Hi Thorpe,The purpose of the pHP code is to actually start the program and not bother with anything that the script outputs. The job of the PHP code is to start the script in event that the script stops.I've got it so that it knows when the script needs to be run again, but it just hangs on issuing the exec command.Michelle. Quote Link to comment Share on other sites More sharing options...
trq Posted January 11, 2007 Share Posted January 11, 2007 Of course it does, its waiting for the script to finnish.Unfortunatley I don't think PHP is a good solution to your problem. Unless you can fork a process, PHP is going to sit there waiting for the script to finnish. Quote Link to comment Share on other sites More sharing options...
msknight Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks Thorpe ... it looks like I'm going to have to look to another solution to the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.