-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
26 lines (21 loc) · 987 Bytes
/
entrypoint.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
#!/usr/bin/env bash
set -e
[ -z "$STORAGE_DIR" ] && { echo "Must provide STORAGE_DIR in environment"; exit 1; }
[ -z "$CLIENT_SECRET" ] && { echo "Must provide CLIENT_SECRET in environment"; exit 1; }
[ -z "$B2_BUCKET" ] && { echo "Must provide B2_BUCKET in environment"; exit 1; }
[ -z "$B2_KEY_ID" ] && { echo "Must provide B2_KEY_ID in environment"; exit 1; }
[ -z "$B2_APP_KEY" ] && { echo "Must provide B2_APP_KEY in environment"; exit 1; }
# Download Photos
echo "⌛️ Downloading Google photos"
gphotos-sync --secret $CLIENT_SECRET --log-level INFO $STORAGE_DIR
# Sync Photos
echo "🌎 Syncing photos"
rclone config create backblaze b2
rclone sync $STORAGE_DIR backblaze:$B2_BUCKET --b2-account $B2_KEY_ID --b2-key $B2_APP_KEY --transfers 16 --copy-links --exclude=".*" -v
# Ping Healthchecks.io
if [ -n "$HEALTH_CHECK_URL" ]; then
echo "🛎 Pinging HealthCheck"
wget $HEALTH_CHECK_URL -T 10 -t 5 -O /dev/null
fi
# Success
echo "✅ Succesfully synced Google photos"