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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user