diff options
author | Michael Lando <ml636r@att.com> | 2017-02-19 10:28:42 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-02-19 10:51:01 +0200 |
commit | 451a3400b76511393c62a444f588a4ed15f4a549 (patch) | |
tree | e4f5873a863d1d3e55618eab48b83262f874719d /sdc-os-chef/scripts/docker_watchdog.sh | |
parent | 5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff) |
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/scripts/docker_watchdog.sh')
-rw-r--r-- | sdc-os-chef/scripts/docker_watchdog.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sdc-os-chef/scripts/docker_watchdog.sh b/sdc-os-chef/scripts/docker_watchdog.sh new file mode 100644 index 0000000000..cc8452537b --- /dev/null +++ b/sdc-os-chef/scripts/docker_watchdog.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "No arguments supplied" + exit 1 +fi + + +RELEASE=$1 +DEP_ENV=$2 + + +docker_ids=`docker ps -a | egrep "Exit" | awk '{print $1}'` +for X in ${docker_ids} +do + docker rm -f ${X} +done + +export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` + +echo "" + +# Back-End +my_cnt=`docker ps|egrep -c "sdc-backend:${RELEASE}"` +if [ "${my_cnt}" -eq "1" ]; then +# echo "`date` - BE is running" >> /data/ASDC/logs/watchdog.log + echo "`date` - BE is running" > /dev/null +else + echo "`date` - BE was down" >> /data/ASDC/logs/watchdog.log + docker pull ecomp-nexus:51212/ecomp/sdc-backend:${RELEASE} + docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 3g --memory-swap=3g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/ASDC/logs/BE/:/var/lib/jetty/logs --volume /data/ASDC/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ecomp-nexus:51212/ecomp/sdc-backend:${RELEASE} +fi + +# Front-End +my_cnt=`docker ps|egrep -c "sdc-frontend:${RELEASE}"` +if [ "${my_cnt}" -eq "1" ]; then +# echo "`date` - FE is running" >> /data/ASDC/logs/watchdog.log + echo "`date` - FE is running" >> /dev/null +else + echo "`date` - FE was down" >> /data/ASDC/logs/watchdog.log + docker pull ecomp-nexus:51212/ecomp/sdc-frontend:${RELEASE} + docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/ASDC/logs/FE/:/var/lib/jetty/logs --volume /data/ASDC/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ecomp-nexus:51212/ecomp/sdc-frontend:${RELEASE} +fi |