I am using a debian server and for some reason when I run this php script using crontab every minute it says that I am using 99% of the %CPU with the php command (in the cronjob the command is php) and the emails will not send. Eventually it says I am out of memory in the tmp folder. The weird part is that for about 10 minutes the cronjob worked perfectly; it sent me the emails every minute and the CPU usage was very low which was good. After that 10 minutes though, the CPU percentage spiked to about 99% again and the emails stopped sending.

If I manually send this email using the command: "php mail1.php", I receive the email with all the contents and there are no problems. With cronjob sending them, I can't even receive 1 anymore. If anyone has any idea why please let me know. Thanks

UPDATE: the server was being finicky so I deleted and retyped the same code over again, as well as deleting and recreating the same cronjob and it works properly.

  • For debugging cron see this Q&A – HBruijn May 11 '16 at 15:24
  • Check your cron PATH & ENV mate. – Grizly May 12 '16 at 4:12

you may have had some white-space in your code that was causing the server to hang. could also be a bad cron path. check your cron logs to see what is causing the server load.

| improve this answer | |
  • This might be better as a comment – Dave M May 22 '16 at 12:49
  • Not even a comment, in this case: Look at the question: the OP resolved it - there was a general server issue, and they restarted the job. Nothing to do with white-space or bad path (since the command originally worked). – David Makogon May 22 '16 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.