restic.sh update to include details on successful backup
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user