From 0d497beb5a38bb64a0f91eefb768bcfd34ffdd9e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 29 Feb 2016 09:33:07 +0100 Subject: certrenew: Remove useless code, improve exit status Signed-off-by: Florian Pritz --- certrenew | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'certrenew') 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 \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 "$@" -- cgit v1.2.3-24-g4f1b