keepalived: keepalived_notify_master.sh

File keepalived_notify_master.sh, 999 bytes (added by krit, 2 years ago)
Line 
1#!/bin/bash
2container_name=node1
3logfile=/tmp/keepalived.log
4echo "Time: $(date). notify log ---------- MASTER -------" >> $logfile
5echo "$1 $2 has transitioned to the $3 state with a priority of $4" >> $logfile
6#echo "/home/ubuntu/nodedb1_start.sh" >> $logfile
7#/home/ubuntu/nodedb1_start.sh
8sleep 70
9echo "wake up from sleep 70 sec" >> $logfile
10/usr/bin/docker start $container_name
11echo "docker start $container_name" >> $logfile
12wait
13sleep 10
14if [ "$( docker container inspect -f '{{.State.Status}}' $container_name )" == "running" ]; then
15   echo "$container_name is running" >> $logfile
16else
17   echo "$container_name is not running, we will start again" >> $logfile
18   /usr/bin/docker start $container_name
19   wait
20   echo "start $container_name Done!!" >> $logfile
21fi
22sleep 10
23/home/ubuntu/notifyFile_3.sh  /home/ubuntu/omd-labs-docker/site/var/naemon &
24echo "start notifyFile_3.sh " >> $logfile
25echo "/home/ubuntu/nodedb1_start.sh" >> $logfile
26su -c "/home/ubuntu/nodedb1_start.sh" ubuntu