From 962cbe166c2c9c8a9690329f5c6ddff3bea50913 Mon Sep 17 00:00:00 2001 From: tolerryan <105945216+tolerryan@users.noreply.github.com> Date: Mon, 30 Dec 2024 01:18:53 -0600 Subject: [PATCH] restic.sh update to include details on successful backup --- roles/lib/setup-restic.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/lib/setup-restic.yml b/roles/lib/setup-restic.yml index 1b52f7f..55716b4 100644 --- a/roles/lib/setup-restic.yml +++ b/roles/lib/setup-restic.yml @@ -105,13 +105,16 @@ if $backup; then echo "Backing up... to misamisa" echo "Date: $(date '+%Y-%m-%d_%H-%M-%S')" # Add your Restic backup command here - restic --password-file ./.resticpassword -r sftp:misamisa://home/restic/$(hostname) backup $backupdir + restic --password-file ./.resticpassword -r sftp:misamisa://home/restic/$(hostname) backup $backupdir \ + | tee backup.out status=$? if [ $status -eq 0 ]; then # If the exit status is 0 (success), send a success message ./discord.sh "$(hostname) backup complete" elif [ $status -eq 3 ]; then - ./discord.sh "$(hostname) backup complete" + details=$(grep -A4 "Added to the repository:"" backup.out) + >backup.out + ./discord.sh "$(hostname) backup complete $details" else # If the exit status is not 0 (failure), send a failure message ./discord.sh "$(hostname) Backup has failed"