#!/bin/bash TYPE=${1} NAME=${2} STATE=${3} case ${STATE} in "MASTER") service haproxy start exit 0 ;; "BACKUP") service haproxy start exit 0 ;; "FAULT") service haproxy stop exit 0 ;; *) echo "unknown state" exit 1 ;; esac