Unable to renew

Hi All,

Why I am getting the following:

[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]#

any body please help?

1 Like

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?

3 Likes

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…

thanks

I don’t understand – Certbot was already installed, probably using your OS’s package manager.

Why did you want to install it twice?

If you can, please don’t run it at exactly 06:00:00 and 23:00:00.

You can use something like this to run it at completely random times:

0 */12 * * * perl -e 'sleep int(rand(43200))' && sh /etc/letsencrypt/certbot-auto renew

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. 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 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):

2 Likes

@mnordhoff

well noted!.. thanks a lot!

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.

3 Likes