crontab with php started, but sometimes it doesnt end
I run a cron job which runs the commandline php to a script which will call a web service and insert data to the DB for like 7hrs daily. The weird thing is it sometimes it never ended.
I checked and had already ensure that if exception is caught, it should still continue to the end of the script. If there's any error in the script, my run.html should show me the error.
my crontab is running a bash script which runs like below every 7 hrs
php run.php >> "run.html"
The situation now is sometimes, my run.html doesnt has anything written . 0 bytes.
When it is running, it has a pid tied to this pro开发者_JAVA百科cess. But after 7hrs when nothing is written in run.html, checking the process again (using the command ps -eo pid,lstart,etime,cmd | grep php ), i realise the process already gone.
I do not time is timeout issue as there is no error shown on php_errors.log , and i've already set in my script
ini_set ("memory_limit",0);
What other causes could it be?
Depending on who is hosting your webserver, it's entirely possible that some admin is either rebooting your server or straightforwardly killing your long running process. (Perhaps he's mistaking it for a zombie?)
I've done a lot of work on sites that are hosted on shared servers, and problems along these lines occur rather frequently, in my experience. It's sort of a pain, too, given that the problem is non-technical, and all you can really do is move to a different host.
So you might want to look into that. Send your hosting provider an email and see if they can shed any light on the situation for you.
Good luck.
精彩评论