In file '/usr/bin/backup2l', function 'do_backup()': Change the order of the following code:
# Run pre-backup
echo "Running pre-backup procedure..."
PRE_BACKUP
# Operate in destination directory
cd $BACKUP_DIR
rm -fr $TMP.*
# Remove old backups...
echo
echo "Removing old backups..."
name_cleanup # should not do anything in normal cases
compute_level_and_bids $1
SAVED_LEVEL=$LEVEL
into:
# Operate in destination directory
cd $BACKUP_DIR
rm -fr $TMP.*
name_cleanup # should not do anything in normal cases
compute_level_and_bids $1
SAVED_LEVEL=$LEVEL
# Run pre-backup
echo "Running pre-backup procedure..."
PRE_BACKUP
# Remove old backups...
echo
echo "Removing old backups..."
Then the variables NEW_BID and LEVEL will be defined in your pre-backup script and contain the BID and level of the new backup.
Gundolf
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to determine if backup2l is doing a full backup (or the level) in the pre/post-backup scripts. If so how?
Thanks
Dear John,
in the present version it is not easily possible.
But you may try the following:
In file '/usr/bin/backup2l', function 'do_backup()': Change the order of the following code:
# Run pre-backup
echo "Running pre-backup procedure..."
PRE_BACKUP
# Operate in destination directory
cd $BACKUP_DIR
rm -fr $TMP.*
# Remove old backups...
echo
echo "Removing old backups..."
name_cleanup # should not do anything in normal cases
compute_level_and_bids $1
SAVED_LEVEL=$LEVEL
into:
# Operate in destination directory
cd $BACKUP_DIR
rm -fr $TMP.*
name_cleanup # should not do anything in normal cases
compute_level_and_bids $1
SAVED_LEVEL=$LEVEL
# Run pre-backup
echo "Running pre-backup procedure..."
PRE_BACKUP
# Remove old backups...
echo
echo "Removing old backups..."
Then the variables NEW_BID and LEVEL will be defined in your pre-backup script and contain the BID and level of the new backup.
Gundolf
Cheers for the reply.
I did end up modifying the script as you mention, but then realised i could do the operation in POST_BACKUP so reverted back.
Thanks