mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 16:03:06 +01:00
19 lines
444 B
Bash
Executable File
19 lines
444 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
DB_FILENAME="/home/mastodon/db-backup-$(date '+%Y-%m-%d').sql"
|
|
|
|
if ! pg_dump -U mastodon 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
|
|
|
|
exit 0
|