Loading pgpool/bin/pgpool_escalation 100644 → 100755 +28 −16 Original line number Diff line number Diff line #!/bin/sh touch /tmp/pgpool_escalation PRIMARY_HOSTNAME=primary DATE=`date '+%Y-%m-%d %H:%M:%S'` DONE="[ done ]" FAIL="[ fail ]" Loading @@ -27,23 +29,33 @@ function align_echo() { fi } # Start/Stop standalone jboss instance result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server=server-standalone:read-attribute(name=server-state)"` 2>$1 if [[ $? != 0 ]]; then align_left "$DOTSTRING" "Start server-standalone" result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server-config=server-standalone:start()"` 2>$1 align_echo $? $result else if [[ $result = *"running"* ]]; then align_left "$DOTSTRING" "Stop server-standalone" result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server-config=server-standalone:stop()"` 2>$1 align_echo $? $result fi if [[ $(hostname) == "$PRIMARY_HOSTNAME" ]]; then echo "$DATE LOG: iserge: This is primary hostname. Skip escalation trigger" exit 0 fi # Start/Stop et7daemon echo "$DATE LOG: iserge: This is standby hostname. Enable and start services" DELEGATE_IP=$(cat /etc/pgpool-II/pgpool.conf | grep delegate_IP | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') # Wait for 15 address up while ! ifconfig | grep -F "$DELEGATE_IP" > /dev/null; do echo "wait" sleep 1 done # Start et7daemon if [[ ! -f /var/run/et7daemon.pid ]]; then /etc/init.d/et7daemon start else /etc/init.d/et7daemon stop fi chkconfig et7daemon on # Start et7sync if [[ ! -f /var/run/et7sync.pid ]]; then /etc/init.d/et7sync start fi chkconfig et7sync on # Start as7-standalone /etc/init.d/as7-standalone start chkconfig as7-standalone on # Start enable sep1 virsh start sep1 virsh autostart sep1 Loading
pgpool/bin/pgpool_escalation 100644 → 100755 +28 −16 Original line number Diff line number Diff line #!/bin/sh touch /tmp/pgpool_escalation PRIMARY_HOSTNAME=primary DATE=`date '+%Y-%m-%d %H:%M:%S'` DONE="[ done ]" FAIL="[ fail ]" Loading @@ -27,23 +29,33 @@ function align_echo() { fi } # Start/Stop standalone jboss instance result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server=server-standalone:read-attribute(name=server-state)"` 2>$1 if [[ $? != 0 ]]; then align_left "$DOTSTRING" "Start server-standalone" result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server-config=server-standalone:start()"` 2>$1 align_echo $? $result else if [[ $result = *"running"* ]]; then align_left "$DOTSTRING" "Stop server-standalone" result=`jboss-cli --controller=$1 --connect --commands="/host=standby/server-config=server-standalone:stop()"` 2>$1 align_echo $? $result fi if [[ $(hostname) == "$PRIMARY_HOSTNAME" ]]; then echo "$DATE LOG: iserge: This is primary hostname. Skip escalation trigger" exit 0 fi # Start/Stop et7daemon echo "$DATE LOG: iserge: This is standby hostname. Enable and start services" DELEGATE_IP=$(cat /etc/pgpool-II/pgpool.conf | grep delegate_IP | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') # Wait for 15 address up while ! ifconfig | grep -F "$DELEGATE_IP" > /dev/null; do echo "wait" sleep 1 done # Start et7daemon if [[ ! -f /var/run/et7daemon.pid ]]; then /etc/init.d/et7daemon start else /etc/init.d/et7daemon stop fi chkconfig et7daemon on # Start et7sync if [[ ! -f /var/run/et7sync.pid ]]; then /etc/init.d/et7sync start fi chkconfig et7sync on # Start as7-standalone /etc/init.d/as7-standalone start chkconfig as7-standalone on # Start enable sep1 virsh start sep1 virsh autostart sep1