20 lines
751 B
Bash
20 lines
751 B
Bash
#!/bin/bash
|
|
|
|
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
|
|
|
|
GOTIFY_TOKEN="token"
|
|
GOTIFY_MESSAGE="Backup task init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"
|
|
GITEA_DIR="/path/to/gitea"
|
|
BACKUP_FILE="gitea-backup_"`date +\%Y\%m\%d`".zip"
|
|
REMOTE_SERVER="remote.example.com"
|
|
REMOTE_PATH="/path/to/remote/store/backups/"
|
|
|
|
# gitea
|
|
su - gitea -s /bin/bash -c "$GITEA_DIR/gitea dump -c $GITEA_DIR/custom/conf/app.ini --file $BACKUP_FILE --tempdir $GITEA_DIR/"
|
|
rsync -AaxzPh --remove-source-files "$GITEA_DIR/$BACKUP_FILE" "$REMOTE_SERVER:$REMOTE_PATH"
|
|
|
|
GOTIFY_MESSAGE="${GOTIFY_MESSAGE} Backup task end: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"
|
|
|
|
# send gotify notification
|
|
sh ./gotifypush.sh "Gitea $(hostname) Backup" "$GOTIFY_MESSAGE" 5 "$GOTIFY_TOKEN"
|