summaryrefslogtreecommitdiffstats
path: root/certrenew
diff options
context:
space:
mode:
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 "$@"