Docker ubuntu cron -f not working

Trying to run a cron job in a docker container. CHECK VOLTAGE (I see cron -f in ps -ef , and if I kill it, it reborn)

crontab file (for testing):
* * * * * echo hi >> /root/test

I tried putting it in /etc/cron.d/crontab /etc/crontab and in /var/spool/cron/crontabs/crontab

Nothing works - I get nothing in /root/test

Any ideas?

+5
source share
1 answer

You can check your crontab syntax; Crontab files in places like /etc/crontab require an extra username field, for example:

 * * * * * root echo hi >> /root/test 

This is documented (not very noticeable) in crontab(5) :

Work in /etc/cron.d/

Tasks in cron.d and / etc / crontab are system tasks that are usually used for more than one user, so an additional username is required ....

+9
source

All Articles