Remove lemmy and postgres backup, switch to sqlite for forgejo and snac backup

This commit is contained in:
Muaz Ahmad 2024-10-23 14:42:52 +05:00
parent 7766c253ff
commit df0ca1fd74

View file

@ -3,22 +3,17 @@
BACKUP_ROOT="Backup $(date -Ihours)"
mkdir "$BACKUP_ROOT"
# Lemmy
LEMMY_ROOT="$BACKUP_ROOT/Lemmy"
mkdir "$LEMMY_ROOT"
cp /opt/lemmy/lemmy-server/lemmy.hjson "$LEMMY_ROOT"
# Snac
SNAC_ROOT="$BACKUP_ROOT/Snac"
mkdir "$SNAC_ROOT"
cp /opt/snac/snac-data "$SNAC_ROOT" -r
# Forgejo
FORGEJO_ROOT="$BACKUP_ROOT/Forgejo"
mkdir "$FORGEJO_ROOT"
su forgejo -c "forgejo dump -f /tmp/forgejo.tar --type tar; tar -f /tmp/forgejo.tar --delete forgejo-db.sql"
su forgejo -c "forgejo dump -f /tmp/forgejo.tar --type tar"
cp /tmp/forgejo.tar "$FORGEJO_ROOT"
# Postgres
POSTGRES_ROOT="$BACKUP_ROOT/Postgres"
mkdir "$POSTGRES_ROOT"
pg_dumpall -c -U postgres -f "$POSTGRES_ROOT/db.sql"
# Compress and send
tar -cavf "./$BACKUP_ROOT.tar.zst" "./$BACKUP_ROOT" && rm -r "$BACKUP_ROOT"
scp "./$BACKUP_ROOT.tar.zst" public@Mehen:~/