#!/usr/bin/env bash set -eu set -o pipefail echo "Backup: perform gitea backup" su --login gitea -c '/home/gitea/gitea-dump.sh' mkdir -p {{ backup_directory }}/gitea mv /home/gitea/backups/* {{ backup_directory }}/gitea echo "Backup: perform backup with gobackup" gobackup perform --config={{ backup_gobackup_config }} echo "Backup: send backups to remote storage with retic" restic-shell.sh backup --verbose {{ backup_directory }} \ && restic-shell.sh check \ && restic-shell.sh forget --compact --prune --keep-daily 90 --keep-monthly 36 \ && restic-shell.sh check echo "Backup: send notification" curl -s -X POST 'https://api.telegram.org/bot{{ notifications_tg_bot_token }}/sendMessage' \ -d 'chat_id={{ notifications_tg_chat_id }}' \ -d 'parse_mode=HTML' \ -d 'text={{ notifications_name }}: бекап успешно завершен!' echo -e "\nRemove old files" keep-files.py {{ backup_directory }}/gitea --keep 2 echo -e "\nBackup: done"