I am trying to add a simple cron job to run in my Docker container. I want it to be added during setup so it will automatically run when
./launcher rebuild app completes.
The cron job works when I manually add it to the
/etc/cron.d/anacron file with
vim but if I edit it without entering and saving the file (i.e. with
echo -n '* * * * * root python3 /var/www/discourse/script/email_me.py' >> /etc/cron.d/anacron), cron does not seem to pickup the change and does not run the job.
If I then add a space anywhere in the file with
vim and save, cron will pickup the change and start running the job.
Since the changes are not picked up when adding them with the
echo command, adding this command to my
app.yml file does not work.
I also tried
docker restart app after echoing in the changes which still did not work.
I feel like there should be an easier way that I’m missing. Having to edit the anacron file after setup seems like the wrong way to do this.