I hope you're doing well.

I am facing a big problem with my cron jobs. Up until today I had two cron jobs to be run in my crontab to be ran at specific times of the day.

Everything ran flawlessly until I added another one, now no cron is running. Even erasing the newly added job didn't fix the issue.

Why did this happen? Can you please help me? Thanks!

Crons for your review:

0  18   * * 1-5 root    cd /var/www/html/require/ && php correoTodosComprobantesHoy.php > ../debug/get_debug_correo_hoy.txt &
0  */2  * * *   root    cd /var/www/html/default/ && php correosDiarios.php > ../debug/get_debug_correos_clientes.txt &
30  18   * * 1-5 root   cd /var/www/html/require/ && php correoTodosEscaneosHoy.php > ../debug/get_debug.txt &
  • Have you checked the log for cron? – Nasir Riley Jul 28 '18 at 1:56
  • I have just checked it and there is no record of the job running at the time it should be – Julio Garcia Jul 28 '18 at 2:05
  • Check /var/log/messages. Look for entries referencing the jobs not running. – Nasir Riley Jul 28 '18 at 2:10
  • @NasirRiley I can't find the file you mentioned :( – Julio Garcia Jul 28 '18 at 2:15
  • Your system doesn't have /var/log/messages???? If that's the case then you've got bigger problems. That log contains messages regarding cron jobs and many other things. – Nasir Riley Jul 28 '18 at 2:19

That makes sense. I didn't notice it before but you need to add a newline after your last job in cron

| improve this answer | |
  • I was not aware this made a difference! Do I need to add is as unicode <\n> or just hit enter? – Julio Garcia Jul 28 '18 at 3:01
  • You can just hit enter. That's always worked for me across many different environments. It's also something that I sometimes forget. – Nasir Riley Jul 28 '18 at 3:02
  • @Julio Garcia You are welcome. Glad to help. – Nasir Riley Jul 28 '18 at 3:08

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.