[英]Cron refuses to reload nginx after certbot certificates renewal
OS : Debian GNU/Linux 10 (buster)操作系统:Debian GNU/Linux 10(克星)
Certbot : certbot 1.11.0 Certbot :certbot 1.11.0
I'm trying to use this cronjob:我正在尝试使用这个 cronjob:
{ certbot renew; nginx -t && service nginx reload; } &>/dev/null
certbot renew
works OK - I see that the certificate is fresh. certbot renew
工作正常 - 我看到证书是新的。 But nginx doesn't being reloaded.但是 nginx 没有被重新加载。
If I enter certbot renew; nginx -t && service nginx reload
如果我输入
certbot renew; nginx -t && service nginx reload
certbot renew; nginx -t && service nginx reload
in command line, everything works perfectly. certbot renew; nginx -t && service nginx reload
在命令行中重新加载,一切正常。
I have read that I can use certbot hooks.我读过我可以使用 certbot 挂钩。 I wrote one in
/etc/letsencrypt/renewal-hooks/deploy/001-restart-nginx.sh
, and here are the permissions:我在
/etc/letsencrypt/renewal-hooks/deploy/001-restart-nginx.sh
中写了一个,这里是权限:
drwxr-xr-x 88 root root 4096 Jan 31 2021 /etc/
drwxr-xr-x 9 root root 4096 Sep 20 19:37 /etc/letsencrypt/
drwxr-xr-x 5 root root 4096 Jan 29 2021 /etc/letsencrypt/renewal-hooks/
drwxr-xr-x 2 root root 4096 May 17 06:10 /etc/letsencrypt/renewal-hooks/deploy/
-rwxr-xr-x 1 root root 21 May 17 06:10 /etc/letsencrypt/renewal-hooks/deploy/001-restart-nginx.sh
The content of 001-restart-nginx.sh
is: 001-restart-nginx.sh
的内容为:
service nginx reload
Even with the hook nginx still doesn't reload.即使挂钩 nginx 仍然不会重新加载。
CRON does not populate the PATH environment variable - so you have to always provide the full path for every command. CRON 不会填充 PATH 环境变量 - 因此您必须始终为每个命令提供完整路径。 In your case these are:
在您的情况下,这些是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.