feat(node): adding node component
Cleaning up the repo
This commit is contained in:
32
components/node/files/scripts/pre-stop-sentinel.sh
Normal file
32
components/node/files/scripts/pre-stop-sentinel.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
source /opt/scripts/common.sh
|
||||
|
||||
tmout=120
|
||||
while true ; do
|
||||
echo "I'm the primary pod and you are stopping me. Starting sentinel failover"
|
||||
echo "Waiting for failover to finish..."
|
||||
fo=$(getFailOverStatus)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Primary has been successfully failed over to a different pod."
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
tmout=$((tmout - 1))
|
||||
if [ "${tmout}" -le 0 ]; then
|
||||
echo "Failover timed out"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Primary has been successfuly failed over to a different pod."
|
||||
|
||||
echo "Removing myself from the sentinel configuration"
|
||||
sentinelReset $(hostname -f)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to remove myself from the sentinel configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user