I wrote two PHP scripts. First one is adding users to one another system calling its API functions. Another script is connecting to FTP, downloads the file, and analyze it. Tuesday I scheduled two cron jobs to run my PHP scripts. My server provider, send me email and informed me that CPU utilization on my server is maximum 100%.
I listed processes on my server, and I can see following:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 11323 30.5 0.8 99756 18120 ? Rs May14 1009:18 /usr/bin/php PATH TO MY PHP SCRIPT
root 11456 30.3 0.8 99756 18120 ? Rs May14 1000:21 /usr/bin/php PATH TO MY PHP SCRIPT
When I run scripts in browser, everything is working perfectliy, script echo to me that it is finished. There is no loop in my scripts.
Interesting is that scheduled cron jobs have never been finished, as you can see from value: 1009:18.
Did someone had similar problem? How it is possible that cron job runs so much time, when execution of the scripts when using browser is taking 4 seconds?