Files
MaxScale/maxscale-system-test/keepalived_cnf/notify_script.sh
Timofey Turenko 022c226d4b Mxs 1665 keepalived masterdown test (#171)
* add keepalived_masterdown test

* add missing cnfs
2018-03-16 15:14:14 +02:00

28 lines
813 B
Bash
Executable File

#!/bin/bash
TYPE=$1
NAME=$2
STATE=$3
OUTFILE=/tmp/state.txt
touch $OUTFILE
#OUTFILE=/home/vagrant/state.txt
case $STATE in
"MASTER") echo "Setting this MaxScale node to active mode $TYPE $NAME $STATE" > $OUTFILE
maxctrl alter maxscale passive false
exit 0
;;
"BACKUP") echo "Setting this MaxScale node to passive mode $TYPE $NAME $STATE" > $OUTFILE
maxctrl alter maxscale passive true
exit 0
;;
"FAULT") echo "MaxScale failed the status check. $TYPE $NAME $STATE" > $OUTFILE
maxctrl alter maxscale passive true
exit 0
;;
*) echo "Unknown state $TYPE $NAME $STATE" > $OUTFILE
exit 1
;;
esac