michaelnet/cuddlefish/backup

12 lines
516 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"
2023-06-25 09:23:54 -07:00
tar -czvf $ARCHIVE gitea-data/ && \
age -e -r age1grpe9c934q09933g7mxne03z7k6e572tjcqxdkne6rwyfht2saeq90sf3f -o $ARCHIVE.enc $ARCHIVE && \
scp -i $BACKUP_KEYPATH -P $BACKUP_SSH_PORT $ARCHIVE.enc $BACKUP_HOST:~/backups/
rm -f $ARCHIVE $ARCHIVE.age && echo Removed $ARCHIVE, $ARCHIVE.enc.