admin-scripts/bin/mastodon-backup
2024-07-14 18:51:57 -05:00

19 lines
545 B
Bash
Executable File

#!/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