#!/usr/bin/env bash set -eu trap "mv /home/mastodon/db-backup.sql.temp /home/mastodon/db-backup.sql" SIGHUP SIGINT SIGQUIT SIGTERM trap "rm -v /home/mastodon/db-backup.sql.temp" EXIT mv -v /home/mastodon/db-backup.sql /home/mastodon/db-backup.sql.temp pg_dump -U mastodon -Fc mastodon_production -p 5432 -f /home/mastodon/db-backup.sql rclone sync -c /home/mastodon/live/public/system/ /mnt/mastodon/system rclone copy -c /home/mastodon/db-backup.sql /mnt/mastodon rclone copy -c /home/mastodon/live/.env.production /mnt/mastodon exit 0