Crontab setup on Centos 8 with apache

Hello guys,

I’ve just setup my letsencrypt certificate on my Centos 8 server running Apache following the guide here:

and it worked great!

But i’m a bit worried about the automatic renewal using cron.

When i try to manually run the added command to cron which is:

python -c ‘import random; import time; time.sleep(random.random() * 3600)’ && /usr/local/bin/certbot-auto renew"

I get an error message saying “python: unknown command”.

So i’ve looked a bit and tried with:

python3 -c ‘import random; import time; time.sleep(random.random() * 3600)’ && /usr/local/bin/certbot-auto renew"

When i use this command i got no output, but if i check letsencrypt logs it looks like the renewal has been sucessful.

Could someone confirm that it’s a mistake in the guide and the command should be python3 instead of python?

Thanks!

Even when you’ve waited at least 3600 seconds? Which is an hour :wink: The command randomly waits between zero and one hour so the Let’s Encrypt systems aren’t hammered at the same minute every hour.

It is highly unusual for python3 to work, but python not. This looks like an error in your CentOS instance. Does the command whereis python give any result?

2 Likes

Thanks for your reply!

Indeed I didn’t wait 1 hour so i guess it’s working fine :wink:

whereis python
python: /usr/bin/python3.6m-config /usr/bin/python3.6-config /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3.6m-x86_64-config /usr/lib/python3.6 /usr/lib64/python3.6 /usr/include/python3.6m /usr/share/man/man1/python.1.gz

This is on a fresh Centos 8 install from the official DVD downloaded yesterday. Then I installed apache, mariadb and nextcloud over it, but i think python3 was already installed by default with the Centos 8 DVD.

Also when you search “Centos 8 dvd python package” you find:

“Python 3.6 is the default Python version.”.
“By default RHEL/CentOS 8 doesn’t have an unversioned system-wide python command to avoid locking the users to a specific version of Python.”

So it seems like “python3 -c” is correct instead on “python -c” on RHEL/Centos 8 right? :slight_smile:

1 Like

Interesting! This is of course not really compliant with the command in the cron job as advertised on certbots page. Perhaps @schoen can be of assistant? Should we update the CentOS cron job on certbots page?

This is a mistake in our instructions.

On RHEL/CentOS 8, you should use python3 instead of python. I’ll get this fixed!

2 Likes