Menu

Determine backup level in Pre-backup script

Help
2008-08-27
2013-04-23
  • John Lister

    John Lister - 2008-08-27

    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

     
    • Gundolf Kiefer

      Gundolf Kiefer - 2008-10-23

      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

       
    • John Lister

      John Lister - 2008-10-27

      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

       

Log in to post a comment.