#!/bin/bash # Variables BACKUP_ROOT_FILES="/backup/files" BACKUP_FILES_RETENTION=10 # Starting backup echo "Starting files backup process ..." # Backup server configuration mkdir -p ${BACKUP_ROOT_FILES} HOUR=`date +%Y%m%d%H%M` tar czf ${BACKUP_ROOT_FILES}/files_${HOUR}.tar.gz /etc # Purge old backup echo "Starting files purge process for backup older than ${BACKUP_PRODUCTS_RETENTION} ..." find ${BACKUP_ROOT_FILES} -type f -mtime +${BACKUP_FILES_RETENTION} -exec rm -f {} \;