Setting Up a Pre-Backup Command that Will Automatically Manage Backups Saved to a Network Share

How to set up a bash script that will automatically manage the backups saved to the network share

This document applies to:

Download pre.sh.

Setting the schedule up

  1. Schedule a daily backup task, choose the network share as a destination for the backup file and select the option to "Create incremental backup if possible":

  2. Set the downloaded pre.sh bash script as a pre-backup command in the Backup Creation Options and specify the following parameters in the 'Arguments' field dividing them by one space:

    Here is an example of the correctly configured pre-backup command:

Here is what this pre-backup command is going to do

  1. Once the amount of backups in the backup folder reaches the predefined limit, it will place the entire set to the folder named set1, set2, set3, etc.

  2. Once the amount of the backup sets reaches the predefined limit, the oldest one (set1) will be deleted and the rest will be renamed in the following way set2->set1, set3->set2, etc.

  3. If you specify 7 and 3 for the amount of the backups in the backup set and the amount of the older backup sets that you want to keep, you will always have no more than 7 backup files in your backup folder and no more than 3 older sets of backups consisting of 7 backup files each (4 sets total, i.e. the current one + 3 older sets).

(!) Note you can specify any other values than 7 and 3.