2024-07-20 23:15:56 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
trap "sudo -u mastodon mv /home/mastodon/db-backup.sql.temp /home/mastodon/db-backup.sql" SIGHUP SIGINT SIGQUIT SIGTERM
|
2024-07-22 04:48:15 +02:00
|
|
|
trap "rm -rf /tmp/log" SIGHUP SIGINT SIGQUIT SIGTERM
|
|
|
|
trap "rm -rv /home/mastodon/db-backup.sql.temp" EXIT
|
2024-07-20 23:15:56 +02:00
|
|
|
|
|
|
|
sudo -u mastodon mv -v /home/mastodon/db-backup.sql /home/mastodon/db-backup.sql.temp
|
|
|
|
sudo -u mastodon pg_dump -U mastodon -Fc mastodon_production -p 5432 -f /home/mastodon/db-backup.sql
|
|
|
|
|
2024-07-22 04:34:40 +02:00
|
|
|
rclone sync -c /etc minio:server0-backup/etc/
|
2024-07-22 04:48:15 +02:00
|
|
|
mkdir /tmp/log
|
|
|
|
rsync -avz /var/log/ /tmp/log
|
|
|
|
rclone sync /tmp/log minio:server0-backup/var-log/
|
|
|
|
rm -rf /tmp/log
|
2024-07-22 04:34:40 +02:00
|
|
|
rclone sync -c /home/jas minio:server0-backup/home-jas/
|
|
|
|
rclone copy -c /home/mastodon/db-backup.sql minio:server0-backup/home-mastodon/
|
|
|
|
rclone copy -c /home/mastodon/live/.env.production minio:server0-backup/home-mastodon/
|
2024-07-20 23:15:56 +02:00
|
|
|
|
|
|
|
exit 0
|