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.
This commit is contained in:
2017-02-09 20:54:41 +01:00
parent c0e3440f1d
commit f909a5c983
+4 -2
View File
@@ -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)