Consul Template À La Place D'haproxy
Fleetingset -o errexit # -e
set -o errtrace # -E
set -o nounset # -u
set -o pipefail
shopt -s inherit_errexit
#+HUGO: more
# Function to handle signals
handle_signal() {
echo "I received signal $1"
}
# Trap all signals from 1 to 64
# avoid sigchld
for sig in $(seq 1 16) $(seq 18 64); do
# Ignore certain signals that cannot be trapped (e.g., 9, 19)
if ! kill -l $sig 2>/dev/null | grep -q "Invalid"; then
trap "handle_signal $(kill -l $sig)" $sig
fi
done
echo here we go
while true
do
sleep 1
done
Put some template in truc.tpl
consul-template -exec-reload-signal SIGUSR1 -exec-splay "5s" -exec ./truc.sh -template "truc.tpl:out.txt"