30 lines
959 B
Bash
30 lines
959 B
Bash
#!/usr/bin/bash
|
|
|
|
# Gitea backup script
|
|
# This script will backup the gitea database and the gitea repository directory
|
|
|
|
# Set the backup directory
|
|
BACKUP_DIR="/home/ubuntu/dump"
|
|
APP_INI="/var/snap/gitea/common/conf/app.ini"
|
|
S3_ENDPOINT_URL="https://s3.us-west-1.wasabisys.com"
|
|
|
|
cd $BACKUP_DIR || exit
|
|
|
|
/usr/bin/ssh masonpayne@192.168.1.90 "say 'Starting Git-tea backup'"
|
|
|
|
# Remove previous backups
|
|
# rm -rf $BACKUP_DIR/*
|
|
rm -rf /home/ubuntu/dump/*
|
|
|
|
/snap/gitea/current/gitea dump -c $APP_INI -w $BACKUP_DIR --type tar
|
|
|
|
# remove left over data folder
|
|
rm -rf /home/ubuntu/dump/data
|
|
|
|
# send backup file to local server
|
|
/usr/bin/scp -r $BACKUP_DIR/ masonpayne@192.168.1.90:gitea-backup/
|
|
/usr/bin/ssh masonpayne@192.168.1.90 "say 'Git-tea local backup complete'"
|
|
|
|
# send backup file to s3
|
|
/usr/local/bin/aws s3 cp $BACKUP_DIR/ s3://gitea-backup/ --recursive --endpoint-url=$S3_ENDPOINT_URL
|
|
/usr/bin/ssh masonpayne@192.168.1.90 "say 'Git-tea cloud backup complete'" |