add error handling of check command

This commit is contained in:
2025-12-20 17:58:07 -06:00
parent 03bd504536
commit cb5c13d0fc

View File

@@ -22,7 +22,11 @@ data:
FILES=$(s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ |
awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}');
if [ -n "${FILES}" ]; then
if [ $? -ne 0 ]; then
ERROR=true;
echo " ";
echo ">> Detected error, will send message to ntfy";
elif [ -n "${FILES}" ]; then
echo " ";
echo ">> Backups to be removed:";
echo "$FILES"