The Little Guy Posted March 3, 2010 Share Posted March 3, 2010 using shell_exec can I run 2+ of the same process on a linux machine? Currently I have this: $newPort = newPort(); socket_write($client, 'new_port:'.$newPort."\0"); shell_exec('~/processes/mini '.$newPort.' &'); what happens, is that it doesn't work if I already have that process running (I think)... is this fixable? Link to comment https://forums.phpfreaks.com/topic/193967-processes/ Share on other sites More sharing options...
trq Posted March 3, 2010 Share Posted March 3, 2010 shell_exec spawns a new process whenever it is called. Link to comment https://forums.phpfreaks.com/topic/193967-processes/#findComment-1020830 Share on other sites More sharing options...
The Little Guy Posted March 3, 2010 Author Share Posted March 3, 2010 using this: shell_exec('~/processes/mini '.$newPort.' &'); I think it makes the code hang, because once I connect with one client, I cannot connect with a second on. I I remove that line, I can connect with 2+ clients. I'm I writing that correctly? Link to comment https://forums.phpfreaks.com/topic/193967-processes/#findComment-1021018 Share on other sites More sharing options...
The Little Guy Posted March 4, 2010 Author Share Posted March 4, 2010 anyone? Link to comment https://forums.phpfreaks.com/topic/193967-processes/#findComment-1021205 Share on other sites More sharing options...
trq Posted March 4, 2010 Share Posted March 4, 2010 You think it makes your code hang? What does mini do exactly? Link to comment https://forums.phpfreaks.com/topic/193967-processes/#findComment-1021214 Share on other sites More sharing options...
The Little Guy Posted March 4, 2010 Author Share Posted March 4, 2010 Yes, I know it hangs, because I placed an echo after it and it doesn't echo it out. I found this: shell_exec("nohup ~/processes/mini $newPort > /dev/null & echo $!"); after using it, it no longer hung, and I was able to have 2+ instances of mini running. server is the main client when a user connects to it, it then it routes them to "mini" the actual chatting client. mini opens a port, and those on that port can chat with each other. anyway, if that made any sense is that a good way to do it? Link to comment https://forums.phpfreaks.com/topic/193967-processes/#findComment-1021217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.