Updated: 2018/08/11
O/S : Linux

NAME   -   Backup directories and files based on the content of the backup list file and the backup exclude list file.

SYNOPSIS     [  -v -h -n  ]    [ -d   0-9  ]   

  • This script is use to create backups (tar or tgz) of directories and files specified in the backup list file ($SADMIN/cfg/backup_list.txt).
    If the backup list file is not present when the script is started, the default backup list file ($SADMIN/cfg/.backup_list.txt) is use as a starting backup list.
  • All files, directories and extensions contained in the backup exclude file ($SADMIN/cfg/backup_exclude.txt) are ignored by the backup script.
    If the backup exclude file is not present when the script is started, the default exclude file ($SADMIN/cfg/.backup_exclude.txt) is use as the exclude list.
  • Directories and files specified in the backup list and that cannot be found during backup execution are skipped and identified as such in the log file and are not consider as an error. This give you the flexibility to use the same backup_list.txt file across multiple servers.
  • For every directory (or file) specified in the backup list, a backup file will be produced. For example, if you specify '/home' and '/etc' in the backup list, two backup files will be produced, one file the 'home' directory and one for the 'etc' directory (See directory structure below).
  • The backup files are stored on the NFS server specified in $SADMIN/cfg/sadmin.cfg (see example below)..
  • By default, 3 copies of the backups will be kept, but you can modify this choice by changing the field "SADM_DAILY_BACKUP_TO_KEEP" in SADMIN configuration file ($SADMIN/cfg/samin.cfg). Extra backup are deleted at the end of each backup.
  • We recommend running this script daily, from the crontab so you don't miss weekly,monthly and yearly backup day.
  • The backup parameters are taken from SADMIN configuration file ($SADMIN/cfg/sadmin.cfg)
    You can change these parameters to meet your needs.

  • Backup Section of SADMIN configuration file ($SADMIN/cfg/sadmin.cfg)

            Name of variable                Description                           Value
            SADM_BACKUP_NFS_SERVER          NFS Backup Server Name or IP        : 
            SADM_BACKUP_NFS_MOUNT_POINT     NFS Backup Mount Point              : /volume1/backup_linux
            SADM_DAILY_BACKUP_TO_KEEP       Nb. of Daily Backup to keep         : 3 
            SADM_WEEKLY_BACKUP_TO_KEEP      Nb. of Weekly Backup to keep        : 3 
            SADM_MONTHLY_BACKUP_TO_KEEP     Nb. of Monthly Backup to keep       : 3 
            SADM_YEARLY_BACKUP_TO_KEEP      Nb. of Yearly Backup to keep        : 2 
            SADM_WEEKLY_BACKUP_DAY          Day of Weekly Backup (1=Mon,.,7=Sun): 5  (Friday)
            SADM_MONTHLY_BACKUP_DATE        Monthly Backup Date (1-28)          : 1  (1st of the month)
            SADM_YEARLY_BACKUP_MONTH        Month to do Yearly Backup (1-12)    : 12 (December)
            SADM_YEARLY_BACKUP_DATE         Date to do Yearly Backup(1-DayInMth): 31 (31th)

  • The directory structure in which the backup are stored offer the flexibility needed to get a quick access to several previous backup in case you need them.
  • Backup files are group by type: 'daily', 'weekly', 'monthly', 'yearly' and the 'latest' directory.
    In each group, there is a sub-directory for each server and within each server, backup a grouped by backup date.
    So it is easy to find the backup you need.
    If you are looking for the latest backup of a server, go in the server sub-directory and then in the 'latest' sub-directory, the more recent backup will always be there.
  • After a couple of days, the backup directories structure should look similar to the one below.
    For example, let's look at the backup structure for server 'raspi0' :
    • We have 3 'daily' backups (9th, 10th and 11th of June 2018).
    • The 'latest' directory contains links to the most recent backup (11th of June)
    • The 'monthly' is taken on the first of each month (First of June 2018)
    • Weekly backup is done every Friday (The 8th was last Friday).
    • For 'yearly' backup, we're going to take it on the 31th of December of each year (not done yet).

  • ├── daily
    │   ├── raspi0
    │   │   ├── 2018_06_09
    │   │   │   ├── 2018_06_09-22_48_13_home.tgz
    │   │   │   ├── 2018_06_09-22_48_32_etc.tgz
    │   │   │   ├── 2018_06_09-22_48_38_root.tgz
    │   │   │   ├── 2018_06_09-22_48_45_sadmin.tgz
    │   │   ├── 2018_06_10
    │   │   │   ├── 2018_06_10-22_48_16_home.tgz
    │   │   │   ├── 2018_06_10-22_48_36_etc.tgz
    │   │   │   ├── 2018_06_10-22_48_42_root.tgz
    │   │   │   ├── 2018_06_10-22_48_49_sadmin.tgz
    │   │   └── 2018_06_11
    │   │       ├── 2018_06_11-22_48_13_home.tgz
    │   │       ├── 2018_06_11-22_48_33_etc.tgz
    │   │       ├── 2018_06_11-22_48_39_root.tgz
    │   │       ├── 2018_06_11-22_48_46_sadmin.tgz
    ├── latest
    │   ├── raspi0
    │   │   ├── 2018_06_11-22_48_13_home.tgz -> ../../daily/raspi0/2018_06_11/2018_06_11-22_48_13_home.tgz
    │   │   ├── 2018_06_11-22_48_33_etc.tgz -> ../../daily/raspi0/2018_06_11/2018_06_11-22_48_33_etc.tgz
    │   │   ├── 2018_06_11-22_48_39_root.tgz -> ../../daily/raspi0/2018_06_11/2018_06_11-22_48_39_root.tgz
    │   │   ├── 2018_06_11-22_48_46_sadmin.tgz -> ../../daily/raspi0/2018_06_11/2018_06_11-22_48_46_sadmin.tgz
    ├── monthly
    │   ├── raspi0
    │   │   └── 2018_06_01
    │   │       ├── 2018_06_01-22_48_14_home.tgz
    │   │       ├── 2018_06_01-22_48_33_etc.tgz
    │   │       ├── 2018_06_01-22_48_39_root.tgz
    │   │       ├── 2018_06_01-22_48_46_sadmin.tgz
    ├── weekly
    │   ├── raspi0
    │   │   └── 2018_06_08
    │   │       ├── 2018_06_08-22_48_16_home.tgz
    │   │       ├── 2018_06_08-22_48_35_etc.tgz
    │   │       ├── 2018_06_08-22_48_41_root.tgz
    │   │       ├── 2018_06_08-22_48_48_sadmin.tgz
    └── yearly
        ├── raspi0


Do not compress backup file(s).
Specify debug level (0-9).
Value of 0 indicate that no debug information is to be displayed.
Display this help and exit.
Output version information and exit.

[0]    An exit status of zero indicates success
[1]    Failure is indicated by a nonzero value, typically ‘1’.

Jacques Duplessis (
Any suggestions or bug report can be sent at

Copyright © 2018 Free Software Foundation, Inc. License GPLv3+:
    - GNU GPL version 3 or later
This is free software, you are free to change and redistribute it.
There is NO WARRANTY to the extent permitted by law.

SEE ALSO  (Backup MariaDB/MySQL Databases)


Copyright © 2015-2019 - - Suggestions, Questions or Report a problem at