diff --git a/run.sh b/run.sh index eeb4fb4..1c4852e 100755 --- a/run.sh +++ b/run.sh @@ -12,41 +12,21 @@ echo "Using cronjob -> ${CRON_SCHEDULE}" echo "Connecting to Minio 💾" -# Capture command output and check for errors -mcli_alias_output=$(mcli alias set myminio $MINIO_ENDPOINT $ACCESS_KEY $SECRET_KEY 2>&1) -if [[ $? -ne 0 ]]; then - echo "Error connecting to Minio: $mcli_alias_output" - exit 1 -fi +mcli alias set myminio $MINIO_ENDPOINT $ACCESS_KEY $SECRET_KEY echo "Starting PostgreSQL database backup ⏳" -# Capture timestamp generation and check for errors -timestamp=$(date +"%m_%d_%Y_%H_%M_%S" 2>&1) -if [[ $? -ne 0 ]]; then - echo "Error generating timestamp" - exit 1 -fi +timestamp=$(date +"%m_%d_%Y_%H_%M_%S") filename=backup_${timestamp}.bak -# Capture pg_dump output and check for errors -pg_dump_output=$(pg_dump -Fc -v -d $DATABASE_URL -f $filename 2>&1) -if [[ $? -ne 0 ]]; then - echo "Error during database backup: $pg_dump_output" - exit 1 -fi +pg_dump -Fc -v -d $DATABASE_URL -f $filename echo "Backup completed successfully 🎉" echo "Uploading to Minio " -# Capture mcli output and check for errors -mcli_upload_output=$(mcli cp $filename myminio/${MINIO_BUCKET} 2>&1) -if [[ $? -ne 0 ]]; then - echo "Error uploading to Minio: $mcli_upload_output" - exit 1 -fi +mcli cp $filename myminio/${MINIO_BUCKET} echo "Upload completed successfully 🎉"