Closed shaqman closed 5 years ago
I'd recommend using /etc/periodic/...
, see also https://github.com/dmstr/phd5-app/blob/master/image-files/etc/periodic/minutely/scheduler and try crontab -l
.
Cron can be tricky in the image, because there are system and user crontab. I found it easier in the end to stick with the /etc/periodic
setup, since it's more flexible when adding cronjobs in subsequent built images.
[edit] you don't need to run a scheduler, you can run yii queue
or any command directly - but be aware of a cleaned ENV when running jobs.
I noticed that cron is available in this image. What is the best way to schedule a cron job, eg: for
yii queue/run
?I tried creating a file and putting it in
/etc/cron.d
, but it doesn't seem to execute. No logging, and the command gives no sign of any effects.Below is the content of my cron file
* * * * * root php /app/yii queue/run > /proc/1/fd/1 2>/proc/1/fd/2
Is this the correct way to use cron here?