Found a nice backup script that with daily, weekly monthly rotation
https://github.com/ccztux/glsysbackup
I use this script to backup my work files and kids photos that stored in Synology NAS, below is the configuration that I use. Always have a few copies of kids’ photos something you will never get back.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
#---------
# Logging:
#---------
# enable log to file
# (possible values: 1|0)
log_to_file="1"
# enable log to stdout
# (possible values: 1|0)
log_to_stdout="0"
# enable log to system logfile
# (possible values: 1|0)
log_to_syslog="0"
# enable log to system journal
# (possible values: 1|0)
log_to_journal="0"
# timestamp format for log messages
# (HINT: have a look at: 'man strftime')
log_timestamp_format="%Y-%m-%d %H:%M:%S"
# truncate logfile at each backup cycle
# (possible values: 1|0)
log_to_file_truncate="0"
#------------
# Privileges:
#------------
# enable this to check if glsysbackup is running with root privileges
# (possible values: 1|0)
root_privileges_required="1"
#--------
# Renice:
#--------
# enable reniceing of glsysbackup and child procs
# (possible values: 1|0)
re_nice_enabled="0"
# set renice priority
# (possible values: -20...19)
# (HINT: have a look at: 'man renice')
re_nice_priority="19"
#-----------
# Re-ionice:
#-----------
# enable re-ioniceing of glsysbackup and child procs
# (possible values: 1|0)
re_ionice_enabled="0"
# set re-ionice scheduling class
# (possible values: 0|1|2|3)
# (HINT: have a look at: 'man ionice')
re_ionice_scheduling_class="2"
# set re-ionice priority
# (possible values: 0...7)
# (HINT: have a look at: 'man ionice')
re_ionice_priority="7"
#----------
# Rotation:
#----------
# keep max 1 backup a day
backup_rotation_one_backup_per_day_only="1"
# enable daily backup rotation
# (possible values: 1|0)
backup_rotation_daily_enabled="1"
# number of backup files to keep of daily backups
backup_rotation_daily_max_backups="14"
# enable weekly backup rotation
# (possible values: 1|0)
backup_rotation_weekly_enabled="1"
# rotation weekday for weekly rotation (1 is monday)
# (possible values: 1|2|3|4|5|6|7)
backup_rotation_weekly_weekday="1"
# number of backup files to keep of weekly backups
backup_rotation_weekly_max_backups="8"
# enable monthly backup rotation
# (possible values: 1|0)
backup_rotation_monthly_enabled="1"
# rotation day of month for monthly rotation (1 is monday)
# (possible values: 1|2|3|...|last day of month)
backup_rotation_monthly_day_of_month="1"
# number of backup files to keep of monthly backups
backup_rotation_monthly_max_backups="3"
#--------------------
# Installed packages:
#--------------------
# enable the creation of installed packages file
# (possible values: 1|0)
installed_packages_enabled="0"
# force this package manager to create installed packages file, if you have more than one package
# manager installed
# (possible values: rpm|dpkg|pacman|equery|pkgutil)
installed_packages_forced_manager=""
# path where installed packages file should be created
installed_packages_directory="/root"
#--------
# Backup:
#--------
# if this value is less equal than the tar rc, the backup job will be interpreted
# as 'backup successful'
# (possible values: 0|1|2)
# (HINT: have a look at: 'man tar' section: 'RETURN VALUE')
backup_successful_tar_rc="1"
# enable backup compression
# (possible values: 1|0)
backup_compression_enabled="1"
# backup compression type
# (possible values: gzip|bzip2|xz|lzip|lzma|lzop)
backup_compression_type="gzip"
# enable backup verbose mode
backup_verbose_mode_enabled="1"
# show backup totals
# (possible values: 1|0)
backup_show_totals="1"
# individual tar options
# (HINT: have a look at: 'man tar')
backup_individual_options=(
""
)
# set backup destination path
backup_destination_path="/var/backups"
# set backup filename
backup_base_filename="${script_config_name}"
# files and folders you want to backup
backup_items=(
"/volume2/home/"
"/volume2/photo"
)
# exclude this items from backup
# (HINT: have a look at: 'man tar')
backup_exlude_items=(
""
)
#------------
# Encryption:
#------------
# enable backup encryption with openssl
# (possible values: 1|0)
backup_encryption_enabled="0"
# set password for encryption
backup_encryption_password="test1234"
#-------------------
# Pre backup script:
#-------------------
# enable pre backup script functionality
# (possible values: 1|0)
pre_backup_script_enabled="0"
# path to pre backup script
pre_backup_script="/home/pi/pre.sh"
# exit glsysbackup in case execution of pre backup script was not successful
# (possible values: 1|0)
pre_backup_exit_when_unsuccessful="1"
#--------------------
# Post backup script:
#--------------------
# enable post backup script functionality
# (possible values: 1|0)
post_backup_script_enabled="0"
# path to post backup script
post_backup_script="/home/pi/post.sh"
# exit glsysbackup in case execution of post backup script was not successful
# (possible values: 1|0)
post_backup_exit_when_unsuccessful="1"