bash - 让 certbot 等待另一个实例
问题描述
我在这里尝试做的是:我有一个由计时器控制的 systemd 服务,该计时器处理letsencrypt证书的更新。配置文件中规定了这些证书的外观。
[Unit]
Description=Let's Encrypt renewal
[Service]
Type=oneshot
Environment=CONFIG_FILE=/etc/letsencrypt/test.conf
ExecStart=-/usr/bin/certbot renew --quiet --agree-tos --noninteractive --no-random-sleep-on-renew
续订会运行一些后处理脚本,以确保部署和安装证书。
如果配置要在证书生成和上次续订之间更改,这些脚本将找不到预期名称下的证书。然后脚本会自动触发另一个脚本,确保创建了证书:
if [[ ! -d /etc/letsencrypt/live/${CERT_NAME} ]]
then
#certificate folder we expect isn't there , request a new cert
. /etc/letsencrypt/renewal-hooks/request-new-cert.sh
fi
我遇到的问题是,在 request-new-cert.sh 执行期间,我收到一个错误Another Instance of Certbot is already running
,导致脚本失败。
我要解决这个问题了吗?有没有更好的方法来尝试实现我想要做的事情?
解决方案
解决方案1:
您需要杀死其他 certbot 进程。您可以通过重新启动盒子或终止特定进程来做到这一点。要查找 certbot 进程,请尝试:
ps -ef | grep certb
进程 ID 将是用户之后的第一个数字,例如:
root 5555 5100 …
要终止该进程,请尝试:
kill 5555
注意:将 5555 替换为您的实际 certbot PID#
解决方案2:
如果它没有运行,请检查您的系统中是否有 .certbot.lock 文件。
find / -type f -name ".certbot.lock"
如果有,您可以删除它们:
find / -type f -name ".certbot.lock" -exec rm {} \;
然后再试一次。
推荐阅读
- reactjs - MaterialUI:纸张或卡片标题
- java - 房间数据库 DAO 查询到带有 int 值的 SUM() 列并返回它...使用 MVM 模型
- jmeter - Jmeter 为 SQL 查询返回“语句未返回结果集”
- spring-cloud-config - 带有 JDBC 的 Spring config server 抛出 Invalid config server configuration 错误
- python - Keras 神经网络准确率仅为 10%
- unity3d - 在 Unity 3D 中移动游戏对象的最佳方式
- javascript - 当 React 中的状态发生变化时,HighCharts 不会更新
- javascript - Rails 应用程序导致 javascript 中断
- java - 如何解析变量在内部类中被访问,需要声明为final
- python - 读取 .arff 文件并尝试忽略标题