bash 中的第二个命令失败,因此重新加载 httpd

bash 中的第二个命令失败,因此重新加载 httpd

我正在尝试运行一个执行一项操作的命令,即更新证书,然后重新加载 Apache。

为此我运行以下命令:

sudo /home/ec2-user/letsencrypt/letsencrypt-auto --config 
/home/ec2-user/letsencrypt/cert.ini certonly --debug 
&& service httpd reload

这给了我以下信息:

Updating letsencrypt and virtual environment dependencies......
Requesting root privileges to run with virtualenv:  /root/.local/share/letsencrypt/bin/letsencrypt --config /home/ec2-user/letsencrypt/secure_textinconfidence_com.ini certonly --debug
Version: 1.1-20080819
Version: 1.1-20080819

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/secure.textinconfidence.com/fullchain.pem.
   Your cert will expire on 2016-05-03. To obtain a new version of the
   certificate in the future, simply run Let's Encrypt again.
 - If you like Let's Encrypt, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Reloading httpd: not reloading due to configuration syntax error
                                                   [FAILED]

但是当我运行时:

sudo service httpd configtest

我得到:

Syntax OK

当与证书更新结合时,我的命令是否有问题?

答案1

正如 @chicks 所述,shell 在没有 sudo 的情况下解释 && 部分,因此执行以下操作:

sudo /home/ec2-user/letsencrypt/letsencrypt-auto --config 
/home/ec2-user/letsencrypt/cert.ini certonly --debug 
&& sudo service httpd reload

问题排序

相关内容