1 | #!/bin/bash |
---|
2 | container_name=node1 |
---|
3 | logfile=/tmp/keepalived.log |
---|
4 | echo "Time: $(date). notify log ---------- MASTER -------" >> $logfile |
---|
5 | echo "$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 |
---|
8 | sleep 70 |
---|
9 | echo "wake up from sleep 70 sec" >> $logfile |
---|
10 | /usr/bin/docker start $container_name |
---|
11 | echo "docker start $container_name" >> $logfile |
---|
12 | wait |
---|
13 | sleep 10 |
---|
14 | if [ "$( docker container inspect -f '{{.State.Status}}' $container_name )" == "running" ]; then |
---|
15 | echo "$container_name is running" >> $logfile |
---|
16 | else |
---|
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 |
---|
21 | fi |
---|
22 | sleep 10 |
---|
23 | /home/ubuntu/notifyFile_3.sh /home/ubuntu/omd-labs-docker/site/var/naemon & |
---|
24 | echo "start notifyFile_3.sh " >> $logfile |
---|
25 | echo "/home/ubuntu/nodedb1_start.sh" >> $logfile |
---|
26 | su -c "/home/ubuntu/nodedb1_start.sh" ubuntu |
---|