Closed esticle closed 4 years ago
Could you give an example of such scripts?
Just an example:
#!/bin/bash
#
source /scripts/pushover-functions.sh
source $my_dir/common.sh # for 'converts'
# Last backup log
cat $log_file >> /log/backup.log
# List of backups
echo Grabbing list of backups
duplicacy list >> /log/list.log
# Files in last revision
echo Saving last revisions file-list
lastrev=`grep ^Snapshot /log/list.log | tail -1 | awk '{print $4}'`
duplicacy list -r ${lastrev} -files >> /log/files.log
# Pushover notification
if [ -n ${PUSHOVER_USERKEY} ] ; then
if [ $exitcode = 0 ] ; then
status=OK
else
status=ERROR
fi
pushover-send "${HOSTNAME} backup $status duration $(converts $duration) and:
`grep -A4 ^'Backup for'` /log/backup.log`
"
fi
Hi,
Here is my proposal for adding a POST_BACKUP_SCRIPT environment variable to be executed after a backup has occurred.
In my particular case I like to do some post-backup actions such as listing all files in the last revision in a log file, keeping the backup log on disk, keeping a list of all revisions in a separate log, etc, the post-backup-hook enables this that not everybody might want to do and which probably will make the list of environment variables too long otherwise.