[20.04.1] Question on crontab (root)

Hello,

I require a bit more of education in terms of crontab jobs listed under the root account on 20.04.1-latest.

My problem is simple: I have added several backup jobs under "sudo crontab -e" but they never seem to be executed.

For example:

5 2 * * 5 rsync -avh --no-links --info=skip0 /home/dd/bin/* /home/dd/bin.NAS

Hence, I am expecting my ~/bin folder to get backed up once a week over to my NAS.

Just today, and just for fun, I have issued the rsync command manually and to my surprise there was a HUGE delta in between source and target (So huge in fact that I know that command was never executed since put in place)

Therefore my question is: are crontab jobs added under the root account executed normally or if something else needs to happen? Bonus question: would I need to add '$mycommand' in between ' ' ? After googling that out, I think the answer is NO but while we're it at, I might as well ask more questions than not as I would really like to get this going flawlessly.

My fear: because the root account is "disabled" in Ubuntu I need to activate something else somewhere (such as change password?). But I would like to think that I am wrong on any of this and that added values to root's crontab would be executed automatically just like with any other distro.

Thanks in advance,

First, https://crontab.guru is your friend to check crontab entries. Second, you know there is /etc/cron.weekly/ where you can add your script and it will run weekly. And third, root account is not disabled, login for that account is (but still, sudo su will make you root).

4 Likes