forked from CANDY-LINE/docker-mysql-backup-cron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_validate.sh
executable file
·32 lines (31 loc) · 887 Bytes
/
_validate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
case $STORAGE_TYPE in
s3)
if [ -z "$ACCESS_KEY" ] || [ -z "$SECRET_KEY" ] || [ -z "$BUCKET" ]; then
echo "[$STORAGE_TYPE] Cannot access to s3 with the given information"
exit 1
fi
;;
swift)
if [ -z "$OS_TENANT_NAME" ] || [ -z "$OS_USERNAME" ] || [ -z "$OS_PASSWORD" ] || [ -z "$CONTAINER" ] || [ -z "$OS_AUTH_URL" ]; then
echo "[$STORAGE_TYPE] Cannot access to swift with the given information"
exit 1
fi
;;
gcs)
if [ -z "$BOTO_PATH" ] || [ -z "$GC_BUCKET" ]; then
echo "[$STORAGE_TYPE] Cannot access to gcs with the given information"
exit 1
fi
;;
local)
if [ ! -d "$BACKUP_DIR" ]; then
echo "[$STORAGE_TYPE] Cannot backup to the missing directory"
exit 1
fi
;;
*)
echo "Unknown storage type => $STORAGE_TYPE. s3, swift or local is valid."
exit 1
;;
esac