2024-05-08 14:07:35 +05:00
|
|
|
#!/usr/bin/sh
|
|
|
|
|
|
|
|
BACKUP_ROOT="Backup $(date -Ihours)"
|
|
|
|
mkdir "$BACKUP_ROOT"
|
|
|
|
|
2024-10-23 14:42:52 +05:00
|
|
|
# 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"
|
2024-10-23 14:42:52 +05:00
|
|
|
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"
|