Skip to content

Example: Using multiple hooks

Noah Huppert edited this page Mar 28, 2017 · 1 revision

Although Dehydrated does not allow you to specify multiple hooks this behavior can be easily hacked together.

This can be done by creating a "proxy" hook that calls the multiple hooks you wish to execute. The simplest way to do this is with a bash script that uses $@ to pass all command line arguments to any hooks you wish to excecute:

#!/usr/bin/env bash
# Simple script which allows the use of multiple hooks
# Put hooks in the order you wish them to be called here:
# (Be sure to keep in mind the working directory *this* hook will be called from when specifying other hook paths.)
./hooks/cloudflare/hook.py "$@" # Hook for automatic DNS-01 challenge deployment on Cloudflare
./hooks/custom/reboot.py "$@" # Made up hook which reboots a made up Nginx server

Then all you have to do is specify the proxy hook with either the HOOK key in a configuration file or the -k command line argument.