From f909a5c9837f7df3303b607a29adfbc53a179d8a Mon Sep 17 00:00:00 2001 From: Jonathan Golder Date: Thu, 9 Feb 2017 20:54:41 +0100 Subject: [PATCH] Make script indipendent from working dir Use absolute path to LECONFIGDIR instead of searching inifiles in currend working dir. Modify striping rules to match new filenames with full path. --- letsencrypt-renew.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/letsencrypt-renew.sh b/letsencrypt-renew.sh index 997d067..79725f5 100755 --- a/letsencrypt-renew.sh +++ b/letsencrypt-renew.sh @@ -1,11 +1,13 @@ #!/bin/bash PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin +LECONFIGDIR="~/.config/letsencrypt" + # Get all existing inifiles matching namescheme cli-${domain}.ini -for inifile in cli-*.ini; do +for inifile in "${LECONFIGDIR}/cli-*.ini"; do # Strip domain out of filename - domain=${inifile:4:-4} + domain=${inifile:$(( ${#LECONFIGDIR} + 5 )):-4} # sleep for a random time so not all certificates get renewed at the same time sleep $(expr $RANDOM % 600)