jjk2 Posted May 16, 2009 Share Posted May 16, 2009 okay so i thoguth about using shell_exec($cmd), however it only returns when it finishes. i need to monitor that a program or job is running ie. exec("wget -r some.com") and check every 25 seconds that the output doesn't have "Finished" is this possible ? Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/ Share on other sites More sharing options...
jjk2 Posted May 16, 2009 Author Share Posted May 16, 2009 azny ideas ?? Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/#findComment-835100 Share on other sites More sharing options...
jjk2 Posted May 16, 2009 Author Share Posted May 16, 2009 please help !!! Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/#findComment-835154 Share on other sites More sharing options...
trq Posted May 16, 2009 Share Posted May 16, 2009 The execution of your script will wait for exec() to finish, so I'm not sure what your trying to get at really. As for checking to see if something is running every 25 seconds, I'm not sure where your going here either. Maybe you need to run a cron every 25 seconds to see whats happening but really, this has little to do with php. Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/#findComment-835159 Share on other sites More sharing options...
jjk2 Posted May 16, 2009 Author Share Posted May 16, 2009 err i mean a shell excuted program is running. i want the php background to check the output of this shell_exeC() or system() to see if its finished. $lastline = system(ls && sleep 10 && ls && sleep 10); while ($output !== "Finished") { sleep(25) echo "Still running" } the problem is that, it just waits until the commands are executed....i need to check on the fly what the shell program is outputting. Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/#findComment-835171 Share on other sites More sharing options...
trq Posted May 16, 2009 Share Posted May 16, 2009 the problem is that, it just waits until the commands are executed....i need to check on the fly what the shell program is outputting. You need to check the output of top, not try and execute the actual commands from php. Honestly, im not sure php is the best tool for this job. You might need to explain in more details exactly what it is your trying to do. Link to comment https://forums.phpfreaks.com/topic/158340-how-to-evalue-that-a-program-is-still-running-in-php-script/#findComment-835189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.