0

I have the following command:

php /var/www/html/XYZ/api_new/XYZ-API/src/public/fetch_events/fetch_events.php

This runs perfectly from the command line. However, I want it to run as a cron job every 15 mins, so I added the following entry to my crontab:

15 * * * * php /var/www/html/XYZ/api_new/XYZ-API/src/public/fetch_events/fetch_events.php

This however, does not seem to work at all. It does not even show up in my system logs (all my other cron jobs do show up).

Any ideas?

Balázs Vincze
  • 3,550
  • 5
  • 29
  • 60
  • see this: https://stackoverflow.com/questions/19443732/configure-cron-job-to-run-every-15-minutes-on-jenkins. your script is making it run every 15th minute of an hour, not every 15 minutes. – Wreigh Jan 26 '18 at 02:20
  • Thanks, but unfortunately it is not a syntax problem. It does not work with all 5 asterisks either. – Balázs Vincze Jan 26 '18 at 02:25
  • try reading this: https://askubuntu.com/questions/23009/why-crontab-scripts-are-not-working for i do not exactly know what's happening on your cron job. – Wreigh Jan 26 '18 at 02:32

1 Answers1

0

There's not really enough information to answer your question, but here are some things that might help.

Sometimes cronjobs don't have context for where to find these programs, so do which php and replace the full path with the php command.

/var/log/cron should have a record of it running, but if there's a problem, you might not know why. Try appending the following to the end of the cron line to aid in debuging:

>> /tmp/fetch_events.log 2>&1

This file will probably contain some hints as to what's going on when the cron does fire.