Skip to content

Commit ae87d92

Browse files
committed
[FIX] commands
1 parent 25ae920 commit ae87d92

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

run.sh

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,21 @@ echo "Using cronjob -> ${CRON_SCHEDULE}"
1212

1313
echo "Connecting to Minio 💾"
1414

15-
# Capture command output and check for errors
16-
mcli_alias_output=$(mcli alias set myminio $MINIO_ENDPOINT $ACCESS_KEY $SECRET_KEY 2>&1)
17-
if [[ $? -ne 0 ]]; then
18-
echo "Error connecting to Minio: $mcli_alias_output"
19-
exit 1
20-
fi
15+
mcli alias set myminio $MINIO_ENDPOINT $ACCESS_KEY $SECRET_KEY
2116

2217
echo "Starting PostgreSQL database backup ⏳"
2318

24-
# Capture timestamp generation and check for errors
25-
timestamp=$(date +"%m_%d_%Y_%H_%M_%S" 2>&1)
26-
if [[ $? -ne 0 ]]; then
27-
echo "Error generating timestamp"
28-
exit 1
29-
fi
19+
timestamp=$(date +"%m_%d_%Y_%H_%M_%S")
3020

3121
filename=backup_${timestamp}.bak
3222

33-
# Capture pg_dump output and check for errors
34-
pg_dump_output=$(pg_dump -Fc -v -d $DATABASE_URL -f $filename 2>&1)
35-
if [[ $? -ne 0 ]]; then
36-
echo "Error during database backup: $pg_dump_output"
37-
exit 1
38-
fi
23+
pg_dump -Fc -v -d $DATABASE_URL -f $filename
3924

4025
echo "Backup completed successfully 🎉"
4126

4227
echo "Uploading to Minio "
4328

44-
# Capture mcli output and check for errors
45-
mcli_upload_output=$(mcli cp $filename myminio/${MINIO_BUCKET} 2>&1)
46-
if [[ $? -ne 0 ]]; then
47-
echo "Error uploading to Minio: $mcli_upload_output"
48-
exit 1
49-
fi
29+
mcli cp $filename myminio/${MINIO_BUCKET}
5030

5131
echo "Upload completed successfully 🎉"
5232

0 commit comments

Comments
 (0)