2024-06-24 23:41:22 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
DB_FILENAME="/home/mastodon/db-backup-$(date '+%Y-%m-%d').sql"
|
|
|
|
|
|
|
|
if ! pg_dump -U mastodon -Fc mastodon_production -p 5432 -f "$DB_FILENAME"; then
|
|
|
|
echo "Error creating backup of mastodon_production database"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Backup of mastodon_production database completed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
find /home/mastodon \
|
|
|
|
-maxdepth 1 \
|
|
|
|
-type f \
|
|
|
|
\( -name "*.sql" -and -not -wholename "$DB_FILENAME" \) \
|
|
|
|
-delete
|
|
|
|
|
|
|
|
if ! rclone copy --transfers=4 /home/mastodon/live/public/system minio:mastodata; then
|
|
|
|
echo "Error rcloning /home/mastodon/live/public/system to MinIO instance"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-06-25 11:09:22 +02:00
|
|
|
if ! rclone copy "${DB_FILENAME}" minio:mastodata; then
|
|
|
|
echo "Error rcloning ${DB_FILENAME} to MinIO instance"
|
2024-06-24 23:41:22 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! rclone copy /home/mastodon/live/.env.production minio:mastodata; then
|
|
|
|
echo "Error rcloning /home/mastodon/live/.env.production to MinIO instance"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|