$ sudo cat /etc/crontab
# ...comment lines elided...
0 0,12 * * * root sleep 1347 && certbot renew -q --post-hook 'sudo reboot'
sudo crontab -e shows
13 0,12 * * * root sleep 1347 && certbot renew -q
This VM is a simple default-configured Google Compute Engine VM with Debian Buster. I am logged in as a user joshua, but note that sudo does not require entering a password.
Which one (or perhaps both?) shows what cron actually does? What is the recommended way to edit the cron config, crontab -e or directly editing some file, e.g. with sudo vi?
sudo crontab -e? There shouldn't be auserfield in that file. It looks like both lines you show are actually from/etc/crontab. What do you mean by "what cron actually does"? Cron will run everything it is told to run. And no,sudo crontab -ewill show root's user-crontab, not yours. – terdon Feb 10 '22 at 11:35sudo crontab -eis wrong, only/etc/crontabshould have a user as the 6th field, so the line should be13 0,12 * * * sleep 1347 && certbot renew -q. – terdon Feb 10 '22 at 11:57crontab -everifies your edits, refuses to install a crontab with errors, and signals the cron daemon that it should refresh its internal copy of the new file.vi crontabdoes none of those things, and is inviting disaster. Also,crontab -lwill list your crontab file. Hint: crontab default editor isnanoon my box --EDITOR=vi crontab -eis my friend here. – Paul_Pedant Feb 10 '22 at 14:35/etc/crontab– Joshua Fox Feb 10 '22 at 15:09