#!/bin/bash # Simple shell script to automate backup to S3 cmpatible storage using Kopia # Copyright (C) 2024 Johannes Randerath # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . cd `dirname ${BASH_SOURCE[0]}` source ./kopia_environment LOGFILE="$LOGPATH/kopia-backup-`date +"%Y%m%d-%H:%M:%S"`" kopia repository connect s3 --bucket=$BUCKET_NAME --access-key=$ACCESS_KEY --secret-access-key=$SECRET_ACCESS_KEY --endpoint=$ENDPOINT -p $REPO_PASSWORD > $LOGFILE 2>&1; for dir in $DIRS; do kopia snapshot create $dir > $LOGFILE 2>&1; done unset BUCKET_NAME ACCESS_KEY SECRET_ACCESS_KEY ENDPOINT DIRS LOGPATH LOGFILE REPO_PASSWORD