From: Eihrister Date: Sun, 18 Dec 2016 19:25:49 +0000 (+0100) Subject: Add new parameter --lock-suffix. (#287) X-Git-Tag: v0.4.0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8456855e48a4240b98b5043eceb6764c1150f2bd;p=thirdparty%2Fdehydrated.git Add new parameter --lock-suffix. (#287) * Add new parameter --lock-suffix. This enables automation systems to run multiple instances of dehydrated while still maintaining a locking facility. This is necessary for projects like https://github.com/GUI/lua-resty-auto-ssl. With this feature, one could run the script multiple times, while still having a form of locking: ./dehydrated --lock-suffix test1.example.com -d test1.example.com ./dehydrated --lock-suffix test2.example.com -d test2.example.com ./dehydrated --lock-suffix test3.example.com -d test3.example.com ./dehydrated --lock-suffix test4.example.com -d test4.example.com ./dehydrated --lock-suffix test5.example.com -d test5.example.com When starts the script with the same locking suffix, the scripts exits like it normally would when locked. This will give you the benefits of using --no-lock, without the disadvantages of it. * Fixed unbound variable error for new PARAM_LOCKFILE_SUFFIX. --- diff --git a/dehydrated b/dehydrated index 3413de2..106eaea 100755 --- a/dehydrated +++ b/dehydrated @@ -184,6 +184,7 @@ load_config() { [[ -z "${DOMAINS_TXT}" ]] && DOMAINS_TXT="${BASEDIR}/domains.txt" [[ -z "${WELLKNOWN}" ]] && WELLKNOWN="/var/www/dehydrated" [[ -z "${LOCKFILE}" ]] && LOCKFILE="${BASEDIR}/lock" + [[ -n "${PARAM_LOCKFILE_SUFFIX:-}" ]] && LOCKFILE="${LOCKFILE}-${PARAM_LOCKFILE_SUFFIX}" [[ -n "${PARAM_NO_LOCK:-}" ]] && LOCKFILE="" [[ -n "${PARAM_HOOK:-}" ]] && HOOK="${PARAM_HOOK}" @@ -1076,6 +1077,14 @@ main() { PARAM_NO_LOCK="yes" ;; + # PARAM_Usage: --lock-suffix example.com + # PARAM_Description: Suffix lockfile name with a string (useful for with -d) + --lock-suffix) + shift 1 + check_parameters "${1:-}" + PARAM_LOCKFILE_SUFFIX="${1}" + ;; + # PARAM_Usage: --ocsp # PARAM_Description: Sets option in CSR indicating OCSP stapling to be mandatory --ocsp)