# How to renew a specific certificate?

**URL:** <https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989>\
**Category:** Help\
**Created:** [February 13, 2018, 12:22pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989 "2018-02-13T12:22:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![WMA](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/wma/32/20377_2.png) [@WMA](https://community.letsencrypt.org/u/WMA)\
**Post date:** [February 13, 2018, 12:22pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/1 "2018-02-13T12:22:23Z")

</div>

I need to check expiration and renew a certain certificate (and subsequently execute a special `--renew-hook` associated with it). How to renew a specific certificate (not all those about to expire)? Thank you.

---

<div class="post-metadata">

**Author:** ![bytecamp](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bytecamp](https://community.letsencrypt.org/u/bytecamp)\
**Post date:** [February 13, 2018, 2:11pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/2 "2018-02-13T14:11:52Z")

</div>

You may use the certonly command for this, but you have to specify the exact set of domain names on the command line. You can list all certificates AND their included names with `certbot certificates`.

Then run `certbot certonly -d domain1 [-d domain2 [-d domain3]]`

Add your hooks to the command line as needed.

See [https://certbot.eff.org/docs/using.html#renewing-certificates](https://certbot.eff.org/docs/using.html#renewing-certificates) for further details.

---

<div class="post-metadata">

**Author:** ![schoen](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/schoen/32/79_2.png) [@schoen](https://community.letsencrypt.org/u/schoen)\
**Post date:** [February 13, 2018, 5:31pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/3 "2018-02-13T17:31:41Z")

</div>

Originally this wasn’t possible with `certbot renew` and so the only option was the way that @bytecamp describes. I believe @erica’s change implementing `--cert-name` with `certbot renew` has been a part of Certbot since version 0.10.0. You can also use `--cert-name` to specify an individual certificate to renew.

---

<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:** [February 13, 2018, 9:08pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/4 "2018-02-13T21:08:47Z")

</div>

You can find the name of the certificate for the command @schoen mentions above with the command `certbot certificates`

Ah, that was also part of the post from @bytecamp I’m just seeing now… 😛

---

<div class="post-metadata">

**Author:** ![Patches](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/patches/32/17145_2.png) [@Patches](https://community.letsencrypt.org/u/Patches)\
**Post date:** [February 13, 2018, 9:26pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/5 "2018-02-13T21:26:18Z")

</div>

Does `renew` with `--cert-name` have different  
behavior with regard to saving hooks?

If not, the OP probably wants to use bytecamp’s method so their hook runs on future automatic renewals…

---

<div class="post-metadata">

**Author:** ![schoen](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/schoen/32/79_2.png) [@schoen](https://community.letsencrypt.org/u/schoen)\
**Post date:** [February 14, 2018, 12:11am UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/6 "2018-02-14T00:11:47Z")

</div>

Like if the hooks are specified on the `renew` command line?

---

<div class="post-metadata">

**Author:** ![Patches](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/patches/32/17145_2.png) [@Patches](https://community.letsencrypt.org/u/Patches)\
**Post date:** [February 14, 2018, 1:09am UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/7 "2018-02-14T01:09:28Z")

</div>

That’s what I meant, but I think I misread the OP. 😳 They did seem to just want to execute their existing renew hook.

---

<div class="post-metadata">

**Author:** ![WMA](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/wma/32/20377_2.png) [@WMA](https://community.letsencrypt.org/u/WMA)\
**Post date:** [February 14, 2018, 1:59pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/8 "2018-02-14T13:59:14Z")

</div>

Thank you very much all for the help. Based on suggestions above, I guess the command needed should look like this:

`certbot renew --renew-hook "/opt/scripts/convert_cert.sh" --cert-name sub.domain.com`

The bad thing is that I cannot test this for sure before the certificate reaches expiration, unless there’s a way to force renewal.

---

<div class="post-metadata">

**Author:** ![bytecamp](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bytecamp](https://community.letsencrypt.org/u/bytecamp)\
**Post date:** [February 14, 2018, 2:05pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/9 "2018-02-14T14:05:37Z")

</div>

> [@WMA](#):
>
> The bad thing is that I cannot test this for sure before the certificate reaches expiration, unless there’s a way to force renewal.

use `--force-renewal` in this case 🙂

---

<div class="post-metadata">

**Author:** ![WMA](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/wma/32/20377_2.png) [@WMA](https://community.letsencrypt.org/u/WMA)\
**Post date:** [February 14, 2018, 2:11pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/10 "2018-02-14T14:11:33Z")

</div>

Tested, works great 🙂 Any idea how often it is recommended to attempt renewal? Every week, 5 days, 3 days? When does certbot treat a certificate as expiring soon? Before how many hours of expiry?

---

<div class="post-metadata">

**Author:** ![bytecamp](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bytecamp](https://community.letsencrypt.org/u/bytecamp)\
**Post date:** [February 14, 2018, 2:13pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/11 "2018-02-14T14:13:25Z")

</div>

`certbot renew` should be run twice a day, it just reissues certificates if they are due for renewal whatsoever. Never run a periodic job with `--force-renewal`, this flag is for corner cases only!

---

<div class="post-metadata">

**Author:** ![mnordhoff](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mnordhoff/32/22583_2.png) [@mnordhoff](https://community.letsencrypt.org/u/mnordhoff)\
**Post date:** [February 14, 2018, 2:15pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/12 "2018-02-14T14:15:29Z")

</div>

> [@WMA](#):
>
> When does certbot treat a certificate as expiring soon? Before how many hours of expiry?

By default, "`certbot renew`" renews certificates when they will expire in less than 30 days.

That can be adjusted, but there's usually no reason to.

---

<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:** [March 16, 2018, 2:15pm UTC](https://community.letsencrypt.org/t/how-to-renew-a-specific-certificate/52989/13 "2018-03-16T14:15:49Z")

</div>

Closed on March 16, 2018, 2:15pm UTC

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