add more examples for messaging

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2014-06-26 17:17:29 +02:00
parent c6ad2e60b3
commit 28ab1c92dd
1 changed files with 42 additions and 0 deletions

View File

@ -57,6 +57,48 @@ if grep -q "^__your_type/object/id:something" "$__messages_in"; then
fi
--------------------------------------------------------------------------------
Some real life examples:
--------------------------------------------------------------------------------
# Reacting on changes from block for keepalive
if grep -q "^__block/keepalive-vrrp" "$__messages_in"; then
echo /etc/init.d/keepalived restart
fi
# Reacting on changes of configuration files
if grep -q "^__file/etc/one" $__messages_in; then
echo 'for init in /etc/init.d/opennebula*; do $init restart; done'
fi
--------------------------------------------------------------------------------
Restart sshd on changes
--------------------------------------------------------------------------------
os="$(cat "$__global/explorer/os")"
case "$os" in
centos|redhat|suse)
restart="/etc/init.d/sshd restart"
;;
debian|ubuntu)
restart="/etc/init.d/ssh restart"
;;
*)
cat << eof >&2
Unsupported os $os.
If you would like to have this type running on $os,
you can either develop the changes and send a pull
request or ask for a quote at www.ungleich.ch
eof
exit 1
;;
esac
if grep -q "^__key_value/PermitRootLogin" "$__messages_in"; then
echo $restart
fi
--------------------------------------------------------------------------------
SEE ALSO
--------