Automated Manifest Update #2755
@@ -13,39 +13,54 @@ data:
|
|||||||
MAX_RETRIES=5
|
MAX_RETRIES=5
|
||||||
SUCCESS=false
|
SUCCESS=false
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo ">> Running Update Port Script ..."
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo ">> Verifying required commands ..."
|
||||||
|
|
||||||
for i in $(seq 1 "$MAX_RETRIES"); do
|
for i in $(seq 1 "$MAX_RETRIES"); do
|
||||||
if apk update 2>&1 >/dev/null; then
|
if apk update 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Repositories are reachable"
|
echo ">> Attempt $i: Repositories are reachable"
|
||||||
SUCCESS=true
|
SUCCESS=true
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ..."
|
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ..."
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$SUCCESS" = false ]; then
|
if [ "$SUCCESS" = false ]; then
|
||||||
|
echo " "
|
||||||
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ..."
|
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v curl 2>&1 >/dev/null; then
|
if ! command -v curl 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Command curl could not be found, installing";
|
echo ">> Command curl could not be found, installing";
|
||||||
apk add --no-cache -q curl;
|
apk add --no-cache -q curl;
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
echo " "
|
||||||
echo ">> Installation successful"
|
echo ">> Installation successful"
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Installation failed with exit code $?"
|
echo ">> Installation failed with exit code $?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
if ! command -v jq 2>&1 >/dev/null; then
|
if ! command -v jq 2>&1 >/dev/null; then
|
||||||
echo "jq could not be found, installing";
|
echo " "
|
||||||
|
echo ">> Command jq could not be found, installing";
|
||||||
apk add --no-cache -q jq;
|
apk add --no-cache -q jq;
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
echo " "
|
||||||
echo ">> Installation successful"
|
echo ">> Installation successful"
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Installation failed with exit code $?"
|
echo ">> Installation failed with exit code $?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ data:
|
|||||||
backup.sh: |
|
backup.sh: |
|
||||||
echo " ";
|
echo " ";
|
||||||
echo ">> Running S3 backup for Vault snapshot";
|
echo ">> Running S3 backup for Vault snapshot";
|
||||||
OUTPUT=$(s3cmd sync --no-check-certificate -v /opt/backup "${BUCKET}/cl01tl/cl01tl-vault-snapshots/" 2>&1)
|
OUTPUT=$(s3cmd sync --no-check-certificate -v /opt/backup/* "${BUCKET}/cl01tl/cl01tl-vault-snapshots/" 2>&1)
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
|
|
||||||
if [ $STATUS -ne 0 ]; then
|
if [ $STATUS -ne 0 ]; then
|
||||||
@@ -35,28 +35,37 @@ data:
|
|||||||
echo " "
|
echo " "
|
||||||
echo ">> Sending message to ntfy using curl ..."
|
echo ">> Sending message to ntfy using curl ..."
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo ">> Verifying required commands ..."
|
||||||
|
|
||||||
for i in $(seq 1 "$MAX_RETRIES"); do
|
for i in $(seq 1 "$MAX_RETRIES"); do
|
||||||
if apk update 2>&1 >/dev/null; then
|
if apk update 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Repositories are reachable";
|
echo ">> Attempt $i: Repositories are reachable";
|
||||||
SUCCESS=true;
|
SUCCESS=true;
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ...";
|
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ...";
|
||||||
sleep 5;
|
sleep 5;
|
||||||
fi;
|
fi;
|
||||||
done;
|
done;
|
||||||
|
|
||||||
if [ "$SUCCESS" = false ]; then
|
if [ "$SUCCESS" = false ]; then
|
||||||
|
echo " "
|
||||||
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ...";
|
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ...";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v curl 2>&1 >/dev/null; then
|
if ! command -v curl 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Command curl could not be found, installing";
|
echo ">> Command curl could not be found, installing";
|
||||||
apk add --no-cache -q curl;
|
apk add --no-cache -q curl;
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
echo " "
|
||||||
echo ">> Installation successful";
|
echo ">> Installation successful";
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Installation failed with exit code $?";
|
echo ">> Installation failed with exit code $?";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
@@ -67,14 +76,18 @@ data:
|
|||||||
|
|
||||||
echo " "
|
echo " "
|
||||||
echo ">> Sending to NTFY ..."
|
echo ">> Sending to NTFY ..."
|
||||||
curl \
|
HTTP_STATUS=$(curl \
|
||||||
--silent \
|
--silent \
|
||||||
|
--write-out '%{http_code}' \
|
||||||
-H "Authorization: Bearer ${NTFY_TOKEN}" \
|
-H "Authorization: Bearer ${NTFY_TOKEN}" \
|
||||||
-H "X-Priority: 5" \
|
-H "X-Priority: 5" \
|
||||||
-H "X-Tags: warning" \
|
-H "X-Tags: warning" \
|
||||||
-H "X-Title: Vault Backup Failed for ${TARGET}" \
|
-H "X-Title: Vault Backup Failed for ${TARGET}" \
|
||||||
-d "$MESSAGE" \
|
-d "$MESSAGE" \
|
||||||
${NTFY_ENDPOINT}/${NTFY_TOPIC}
|
${NTFY_ENDPOINT}/${NTFY_TOPIC}
|
||||||
|
)
|
||||||
|
echo ">> HTTP Status Code: $HTTP_STATUS"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo " ";
|
echo " ";
|
||||||
echo ">> S3 Sync succeeded"
|
echo ">> S3 Sync succeeded"
|
||||||
|
|||||||
@@ -13,28 +13,40 @@ data:
|
|||||||
MAX_RETRIES=5
|
MAX_RETRIES=5
|
||||||
SUCCESS=false
|
SUCCESS=false
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo ">> Running Vault Snapshot Script ..."
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo ">> Verifying required commands ..."
|
||||||
|
|
||||||
for i in $(seq 1 "$MAX_RETRIES"); do
|
for i in $(seq 1 "$MAX_RETRIES"); do
|
||||||
if apk update 2>&1 >/dev/null; then
|
if apk update 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Repositories are reachable";
|
echo ">> Attempt $i: Repositories are reachable";
|
||||||
SUCCESS=true;
|
SUCCESS=true;
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ...";
|
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ...";
|
||||||
sleep 5;
|
sleep 5;
|
||||||
fi;
|
fi;
|
||||||
done;
|
done;
|
||||||
|
|
||||||
if [ "$SUCCESS" = false ]; then
|
if [ "$SUCCESS" = false ]; then
|
||||||
|
echo " "
|
||||||
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ...";
|
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ...";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v jq 2>&1 >/dev/null; then
|
if ! command -v jq 2>&1 >/dev/null; then
|
||||||
|
echo " "
|
||||||
echo ">> Command jq could not be found, installing";
|
echo ">> Command jq could not be found, installing";
|
||||||
apk add --no-cache -q jq;
|
apk add --no-cache -q jq;
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
echo " "
|
||||||
echo ">> Installation successful";
|
echo ">> Installation successful";
|
||||||
else
|
else
|
||||||
|
echo " "
|
||||||
echo ">> Installation failed with exit code $?";
|
echo ">> Installation failed with exit code $?";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
Reference in New Issue
Block a user