Linux的cron定时任务无法执行certbot的脚本

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 domain is:

I ran this command:certbot certonly --manual --preferred-challenges http -d

It produced this output:

My web server is (include version):

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

My hosting provider, if applicable, is:

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

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

Hi @Xiaokai,

I didn't understand (from machine translation of your forum topic) exactly what kind of problem you have with running Certbot from cron.

Your command certbot certonly --manual --preferred-challenges http -d looks incomplete to me because the -d option goes with --webroot rather than --manual (it's used to specify a webroot directory).

If you already got a valid certificate running a version of this command, then you might be having a problem with certbot renew running from cron: normally certbot renew cannot renew certificates that were obtained using --manual. That is part of the meaning of --manual (it requires human interaction).

Apparently the Chinese equivalent might be "手动", contrasting with "自动". Since certbot renew is for automatic (unattended, noninteractive) certificate renewal, it will not be able to complete a certificate renewal process that requires manual intervention by the user.

If you're getting a specific error message, could you please share that message so we can understand more specifically what the problem might be?

3 Likes

我写了一个自动的证书续签脚本,正常运行结果都是可以出来的,但是写到了定时任务的时候就不执行了

What operating system and version are you using? Windows?

3 Likes

Sorry, someone pointed out that this part is wrong (I was thinking of -w, not -d).

4 Likes

Can you post the script and the specific error message?

4 Likes

用的是linux

没有任何报错,感觉论坛很不方便,要不然我都想直接给你截图我的脚本了。。。

脚本定时执行的时候也不报错,但是就是不执行
另外您知道expect这个命令吗?

The PATH used in cron is sometimes different than what is used on the command line

You can use the upload icon on the post menu to upload a picture. Upload your script and cron file

3 Likes

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