I am trying to run a command that carries out one action, to renew a certificate, and then reloads Apache.

To do this I am running the following:

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

Which gives me the following:

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

 - Congratulations! Your certificate and chain have been saved at
   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

However when I run:

sudo service httpd configtest

I get:

Syntax OK

Is there something wrong with my command when combining with the cert renewal?

  • 1
    Please have a look with the logs /var/log/httpd/error_log and syslog and share output here. Feb 9 '16 at 13:53
  • I re-ran the command and then checked the logs. There is nothing in any of the log files for the time so nothing to share.
    – williamsdb
    Feb 9 '16 at 14:31
  • Then try to start service directly /etc/init.d/httpd restart and check log or output here. Feb 9 '16 at 14:48
  • Unfortunately that gives exactly the same error.
    – williamsdb
    Feb 9 '16 at 15:58
  • what happens if you sudo service httpd reload without the LE stuff? I'm wondering if the shell is interpreting the && part without sudo. You might need to sudo twice.
    – chicks
    Feb 9 '16 at 18:54

As stated by @chicks the shell is interpreting the && part without sudo so doing:

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

Sorts the problem

  • NIcely done sir.
    – chicks
    Feb 10 '16 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.