random-stuff/bash_scripts/backup_public

21 lines
504 B
Text
Raw Permalink Normal View History

2024-05-08 14:07:35 +05:00
#!/usr/bin/sh
BACKUP_ROOT="Backup $(date -Ihours)"
mkdir "$BACKUP_ROOT"
# Snac
SNAC_ROOT="$BACKUP_ROOT/Snac"
mkdir "$SNAC_ROOT"
cp /opt/snac/snac-data "$SNAC_ROOT" -r
2024-05-08 14:07:35 +05:00
# Forgejo
FORGEJO_ROOT="$BACKUP_ROOT/Forgejo"
mkdir "$FORGEJO_ROOT"
su forgejo -c "forgejo dump -f /tmp/forgejo.tar --type tar"
2024-05-08 14:07:35 +05:00
cp /tmp/forgejo.tar "$FORGEJO_ROOT"
# Compress and send
tar -cavf "./$BACKUP_ROOT.tar.zst" "./$BACKUP_ROOT" && rm -r "$BACKUP_ROOT"
2024-05-13 14:02:33 +05:00
scp "./$BACKUP_ROOT.tar.zst" public@Mehen:~/
2024-05-08 14:07:35 +05:00
rm "./$BACKUP_ROOT.tar.zst"