Creating certbot-auto renew cron job is problematic

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: n/a

I ran this command: see below

It produced this output: none

My web server is (include version): Apache 2.2.15

The operating system my web server runs on is (include version): CenOS 6.10

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): certbot 0.39.0

I installed several LE certificates which are working fine. I then tried to automate the renewal process using the recommended line on https://certbot.eff.org/lets-encrypt/centos6-apache which suggests adding a cronjob using the following statement

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/crontab > /dev/null

Although certbot-auto renew from the command line does what it is supposed to do, the above statement created the cron job in /etc/crontab although the latter part | sudo tee -a /etc/crontab > /dev/null is missing

I also have the following cron directories in /etc (and one cronjob in /var/spool/cron)

cron.d
cron.daily
cron.hourly
cron.monthly and
cron.weekly

Except for the latter two that are empty, they contain named cron job files

the crontab -l command gives me only the cron job listed in the /var/spool/cron directory.

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /etc/webmin/status/monitor.pl

My questions are:

  1. Why does crontab -l not list the other cron jobs in cron.* directories and /etc/crontab?
  2. Why so many places for cron jobs
  3. Am I also supposed to create a file with the recommended statement in the cron.daily directory or the /var/spool/cron directory?
  4. Is the name of the cron job of any consequence?

Thanks

It predates the existence of the other directories and is mostly meant for use by non-root users.

A long history of the cron program and different ideas from different developers about what would be most convenient for particular use cases.

The /etc/cron.d mechanism is probably originally from Debian, which has favored the idea of having /etc/something.d directories where new packages can install files related to their own configuration without having to edit other packages' files.

One location is enough. Each location is checked separately.

No, unless you intend for it to be enabled or disabled by other software.

1 Like

@shoen Thanks for the enlightenment. Cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.