[root@localhost opt]# sh certbot renew
/usr/bin/certbot: line 3: requires: command not found
/usr/bin/certbot: line 4: import: command not found
/usr/bin/certbot: line 5: from: command not found
/usr/bin/certbot: certbot: line 8: syntax error near unexpected token newline' /usr/bin/certbot: certbot: line 8: sys.exit(β
[root@localhost opt]#
Your certbot is a Python program, not a shell script.
(certbot-auto, an alternative way to install Certbot, is in fact a shell script, which does some setup and then executes the Python program. βsh certbotβ would have worked if you were using it before.)
What if you just run βcertbot renewβ without βshβ in front?
I forgot to put sh in front⦠but the problem still occurs!..
I installed certbot-auto:
wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto
and mv certbot-auto to /etc/letsencrypt
and try it --> sh certbot-auto renew
and now it works as expected β¦
and now I have changed my crontab to 0 6,23 * * * sh /etc/letsencrypt/certbot-auto renew
if you found something missing . please let me knowβ¦
There may already be another cron job or systemd timer set up by your other Certbot installation.
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. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
My web server is (include version):
The operating system my web server runs on is (include version):
My hosting provider, if applicable, is:
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
When you do this, you don't need to run it as sh /etc/letsencrypt/certbot-auto, you can run it directly as /etc/letsencrypt/certbot-auto. The certbot-auto and certbot programs (written respectively in the Bourne shell and Python) both start with shebang lines that tell the operating system which scripting language interpreter to use to execute them.
So you don't have to specify the interpreter when running them, as long as they are marked executable in the filesystem.