Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Added a loop to monit-start to account for monit process locks
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Hall <[email protected]>
  • Loading branch information
Urvashi Reddy authored and tvs committed Oct 18, 2018
1 parent be21823 commit afff3af
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions jobs/bbr-etcd/templates/post-restore-unlock.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@ set -euo pipefail

echo "Starting etcd"

/var/vcap/bosh/bin/monit start etcd

TIMEOUT=60
if timeout "$TIMEOUT" /bin/bash <<EOF
#!/bin/bash
until /var/vcap/bosh/bin/monit start etcd; do
echo "starting etcd"
sleep 5
done
EOF
then
echo "monit has started etcd"
else
echo "monit was unable to start etcd after $TIMEOUT seconds"
exit 1
fi

if timeout "$TIMEOUT" /bin/bash <<EOF
#!/bin/bash
until /var/vcap/bosh/bin/monit summary | grep etcd | grep running ; do
echo "waiting for etcd to start..."
until /var/vcap/bosh/bin/monit summary | grep etcd | grep "running"; do
echo "waiting for etcd daemon to start"
sleep 5
done
EOF
then
echo "Etcd has been started and is running"
echo "etcd daemon has started"
else
echo "Timed out starting etcd after $TIMEOUT seconds"
echo "etcd daemon was unable to start after $TIMEOUT seconds"
exit 1
fi

0 comments on commit afff3af

Please sign in to comment.