Using CentOS 8 I want to add a
cron which shall execute below command after every month
sudo certbot renew --non-interactive
Can someone please assist how actually I can do it using Linux shell.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Having just set this up myself recently, I found the documentation for getting up and running with certbot to be excellent (https://certbot.eff.org/lets-encrypt/centosrhel8-nginx). Their specific recommendation is to run the following command:
echo "0 0,12 * * * root python3 -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew -q" | sudo tee -a /etc/crontab > /dev/null
This will run the command
/usr/local/bin/certbot-auto renew -q at 00:00 and 12:00 every day after sleeping for a random number of seconds between 0 and 3600. The injection of the random number of seconds is to stop their servers being overloaded on the exact hour/minute when crons are setup. I would go with their recommendation because the more frequent the check, the less likely you are to be hit by random connectivity issues. Please note, it only updates the certificate if it needs to.