]> git.street.me.uk Git - andy/dehydrated.git/commitdiff
Add new parameter --lock-suffix. (#287)
authorEihrister <daniel@mostertman.org>
Sun, 18 Dec 2016 19:25:49 +0000 (20:25 +0100)
committerLukas Schauer <lukas2511@users.noreply.github.com>
Sun, 18 Dec 2016 19:25:49 +0000 (20:25 +0100)
* 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.

dehydrated

index 3413de2a01907bd3895befdbb4b7789ce4cc3309..106eaea87789a44e9ed530e168b597de81b4194c 100755 (executable)
@@ -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)