32 lines
825 B
Bash
Raw Normal View History

2015-06-16 13:07:17 +02:00
#!/bin/bash
2015-06-16 14:06:49 +02:00
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
2015-06-16 13:07:17 +02:00
TYPE=$1
NAME=$2
STATE=$3
case $STATE in
2017-07-13 12:32:31 +02:00
"MASTER") echo "I'm the MASTER! Whup whup." > /proc/1/fd/1
2015-06-16 13:07:17 +02:00
exit 0
;;
2017-07-13 12:32:31 +02:00
"BACKUP") echo "Ok, i'm just a backup, great." > /proc/1/fd/1
2015-06-16 13:07:17 +02:00
exit 0
;;
2017-07-13 12:32:31 +02:00
"FAULT") echo "Fault, what ?" > /proc/1/fd/1
2015-06-16 13:07:17 +02:00
exit 0
;;
2017-07-13 12:32:31 +02:00
*) echo "Unknown state" > /proc/1/fd/1
2015-06-16 13:07:17 +02:00
exit 1
;;
esac