0

When I build my server image, I write the following to a temporary file;

* * * * * php /var/www/artisan schedule:run

and then load it with

crontab < /tmp/cron

After deployment of the image, I run cron -f and I can see that the process is indeed running, but the cronjob is not being initiated.

If I run crontab -e, add a space, save it, run crontab -e again and remove the space, the cronjob working just fine without reload of cron.

I've tried reloading the cron on build with /etc/init.d/cron reload, but this does not solve the issue.

Hedam
  • 203

1 Answers1

0

crontab needs to be notified. You can do something like this to (carefully!) append through the commandline or with a script:

(crontab -l 2>/dev/null; echo "* * * * * php /var/www/artisan schedule:run") | crontab -

The 2>/dev/null; suppresses crontab's message when a user has an empty crontab.