20 lines
504 B
Bash
Executable file
20 lines
504 B
Bash
Executable file
#!/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
|
|
|
|
# Forgejo
|
|
FORGEJO_ROOT="$BACKUP_ROOT/Forgejo"
|
|
mkdir "$FORGEJO_ROOT"
|
|
su forgejo -c "forgejo dump -f /tmp/forgejo.tar --type tar"
|
|
cp /tmp/forgejo.tar "$FORGEJO_ROOT"
|
|
|
|
# Compress and send
|
|
tar -cavf "./$BACKUP_ROOT.tar.zst" "./$BACKUP_ROOT" && rm -r "$BACKUP_ROOT"
|
|
scp "./$BACKUP_ROOT.tar.zst" public@Mehen:~/
|
|
rm "./$BACKUP_ROOT.tar.zst"
|