michaelnet/cuddlefish/backup

12 lines
373 B
Plaintext
Raw Normal View History

2023-05-26 12:05:53 -07:00
#!/bin/bash
2023-06-15 16:42:42 -07:00
# NOTE: DEPENDING ON PERMISSIONING, YOU MAY NEED TO RUN THIS SCRIPT USING SUDO
2023-05-26 12:05:53 -07:00
2023-06-15 16:42:42 -07:00
source .env
2023-05-26 12:05:53 -07:00
2023-06-15 16:42:42 -07:00
DATESTRING=$(date +"%Y-%m-%d_%H%M%S" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')
ARCHIVE="gitea-data-${DATESTRING}.tar.gz"
tar -czvf $ARCHIVE gitea-data/
scp -i $BACKUP_KEYPATH -P $BACKUP_SSH_PORT $ARCHIVE $BACKUP_HOST:~/backups/
rm $ARCHIVE && echo Removed $ARCHIVE.