# Why is post-hook invoked without adding it in command line?

**URL:** <https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201>\
**Category:** Help\
**Created:** [June 20, 2019, 5:08am UTC](https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201 "2019-06-20T05:08:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lzl124631x](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/lzl124631x/32/32559_2.png) [@lzl124631x](https://community.letsencrypt.org/u/lzl124631x)\
**Post date:** [June 20, 2019, 5:08am UTC](https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201/1 "2019-06-20T05:08:15Z")

</div>

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. [https://crt.sh/?q=example.com](https://crt.sh/?q=example.com)), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:  
explorer.harmony.one

I ran this command:

```auto
$ ./certbot-auto renew --dry-run

```

It produced this output:

```auto
Requesting to rerun ./certbot-auto with root privileges...

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Processing /etc/letsencrypt/renewal/explorer.harmony.one.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Cert not due for renewal, but simulating renewal for dry run

Plugins selected: Authenticator standalone, Installer None

Renewing an existing certificate

Performing the following challenges:

http-01 challenge for explorer.harmony.one

Waiting for verification...

Challenge failed for domain explorer.harmony.one

http-01 challenge for explorer.harmony.one

Cleaning up challenges

Attempting to renew cert (explorer.harmony.one) from /etc/letsencrypt/renewal/explorer.harmony.one.conf produced an unexpected error: Some challenges have failed.. Skipping.

All renewal attempts failed. The following certs could not be renewed:

/etc/letsencrypt/live/explorer.harmony.one/fullchain.pem (failure)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

** DRY RUN: simulating 'certbot renew' close to cert expiry

** (The test certificates below have not been saved.)

All renewal attempts failed. The following certs could not be renewed:

/etc/letsencrypt/live/explorer.harmony.one/fullchain.pem (failure)

** DRY RUN: simulating 'certbot renew' close to cert expiry

** (The test certificates above have not been saved.)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Running post-hook command: /home/ec2-user/restart-fe.sh

Output from post-hook command restart-fe.sh:

No screen session found.

post-hook command "/home/ec2-user/restart-fe.sh" returned error code 1

1 renew failure(s), 0 parse failure(s)

```

My web server is (include version):  
node express

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is:  
Amazon Linux 2.

I can login to a root shell on my machine (yes or no, or I don’t know):  
yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of `certbot --version` or `certbot-auto --version` if you’re using Certbot):

0.35.1

* * *

Background:

I indeed added `--post-hook` for the crontab job. But when I run the command manually, it still calls `post-hook` even if I didn’t specify it.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [June 20, 2019, 5:10am UTC](https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201/2 "2019-06-20T05:10:44Z")

</div>

> [@lzl124631x](#):
>
> Why is post-hook invoked without adding it in command line?
> 
> I ran this command:
> 
> ```nohighlight
> $ ./certbot-auto renew --dry-run
> 
> ```

Probably because when you ran certbot for the first time to get the certificate in the first place, you _did_ include it on the command line. It is saved in the renewal configuration file, as certbot assumes it is necessary for every time you get a certificate. So when you run `renew`, it uses all the saved information, including the post-hook command.

---

<div class="post-metadata">

**Author:** ![lzl124631x](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/lzl124631x/32/32559_2.png) [@lzl124631x](https://community.letsencrypt.org/u/lzl124631x)\
**Post date:** [June 20, 2019, 5:27am UTC](https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201/3 "2019-06-20T05:27:01Z")

</div>

> [@Osiris](#):
>
> certificate. So when you run `renew` , it uses all the saved information, including the post-hook command.

Thanks! It wasn't obvious that a successful run will have side effect to the config file.

I removed the `post_hook` line in `/etc/letsencrypt/renewal/explorer.harmony.one.conf `.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [July 20, 2019, 5:27am UTC](https://community.letsencrypt.org/t/why-is-post-hook-invoked-without-adding-it-in-command-line/96201/4 "2019-07-20T05:27:03Z")

</div>

Closed on July 20, 2019, 5:27am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
