2015-06-16 11:07:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-06-16 12:06:49 +00: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 11:07:17 +00:00
|
|
|
TYPE=$1
|
|
|
|
NAME=$2
|
|
|
|
STATE=$3
|
|
|
|
|
|
|
|
case $STATE in
|
2015-08-03 17:54:27 +00:00
|
|
|
"MASTER") logger -s -t keepalived-notify "I'm the MASTER! Whup whup."
|
2015-06-16 11:07:17 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2015-08-03 17:54:27 +00:00
|
|
|
"BACKUP") logger -s -t keepalived-notify "Ok, i'm just a backup, great."
|
2015-06-16 11:07:17 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2015-08-03 17:54:27 +00:00
|
|
|
"FAULT") logger -s -t keepalived-notify "Fault, what ?"
|
2015-06-16 11:07:17 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2015-08-03 17:54:27 +00:00
|
|
|
*) logger -s -t keepalived-notify "Unknown state"
|
2015-06-16 11:07:17 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|