Trying to automate cert renewal but says there is a problem with httpd config


#1

I have been able to create and renew certs from the command line without any problems but I am now wanting to move this to cron. To do this I am running this on the command line as a test before moving to cron:

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

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]

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?


#2

Answered my own question - service httpd reload needed sudo before it.