diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-02-29 09:33:07 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-02-29 09:33:07 +0100 |
commit | 0d497beb5a38bb64a0f91eefb768bcfd34ffdd9e (patch) | |
tree | 609b6a646130ded09c6a7c0a6840a286d63ff5f9 /certrenew | |
parent | 08a719a01cf73b6c9cd897cd51d5dcfecb81b582 (diff) | |
download | bin-0d497beb5a38bb64a0f91eefb768bcfd34ffdd9e.tar.gz bin-0d497beb5a38bb64a0f91eefb768bcfd34ffdd9e.tar.xz |
certrenew: Remove useless code, improve exit status
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'certrenew')
-rwxr-xr-x | certrenew | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -3,10 +3,6 @@ set -e main() { - if [[ ! -d /etc/letsencrypt/live ]]; then - die "no letsencrypt dir found" - fi - if (($#<2)); then printf "usage: %s <webroot> <domains ...>\n" "${0##*/}" exit 1 @@ -20,14 +16,12 @@ main() { # renew if expires within 8 weeks if ! openssl x509 -noout -checkend $((8*7*86400)) -in "${cert}"; then letsencrypt certonly --email bluewind@xinu.at --agree-tos --renew-by-default --webroot -w "$webroot" "${domains[@]/#/-d }" + return 0 fi - return 0 -} - -die() { - printf "%s\n" "$1" >&2 - exit 1 + # exit 1 so that scripts using this can check we the cert has been updated + # (certrenew .. && systemctl reload ..) + return 1 } main "$@" |