Need to run this shell file in the background every 10 secs
Posted by mikey1090, 03-19-2007, 04:44 PM The following shell script (a php loop to run a file) That is in a file named "myfile" placed in the root how can i run that in the background every 10 seconds, so when i close putty it still runs mike
Posted by Engelmacher, 03-19-2007, 04:57 PM Why does it need to be a PHP file and why do you need to run it every 10 seconds if it loops on its own?
Posted by Barti1987, 03-19-2007, 05:06 PM Put the command to run the file in crontab. I am not sure how the look of it will be, but I am thinking of something like this would run each minute (I don't think cron works in seconds, would probably would kill the server): Peace,
Posted by Russ Foster, 03-19-2007, 05:09 PM You might want to look at something like nohup which will cause a program to still run if the session is closed
Posted by mikey1090, 03-19-2007, 05:33 PM thanks, that helped
Posted by Extreme43, 03-19-2007, 08:06 PM You might want to use the following during each loop
Posted by mikey1090, 03-20-2007, 06:08 AM thanks i might use that. Will my loop keep stopping every 30 seconds otherwise?
Posted by sergeysg, 03-20-2007, 05:50 PM It depends on your php.ini settings and yes, it is 30 seconds by default, but this DOESN'T affect usage of PHP in command line (CLI) mode. Quote from manual: BTW you can specify the path to php.ini file when you call php from command line using -c parameter - useful very often to have custom php.ini for PHP command line usage.