summaryrefslogtreecommitdiffstats
path: root/certrenew
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-02-29 09:33:07 +0100
committerFlorian Pritz <bluewind@xinu.at>2016-02-29 09:33:07 +0100
commit0d497beb5a38bb64a0f91eefb768bcfd34ffdd9e (patch)
tree609b6a646130ded09c6a7c0a6840a286d63ff5f9 /certrenew
parent08a719a01cf73b6c9cd897cd51d5dcfecb81b582 (diff)
downloadbin-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-xcertrenew14
1 files changed, 4 insertions, 10 deletions
diff --git a/certrenew b/certrenew
index 8d696fa..0d60ef6 100755
--- a/certrenew
+++ b/certrenew
@@ -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 "$@"