Ubuntu Server with rsync backup mechanism

Create a script
cd / root

touch sprin.sh

vim sprin.sh

#!/bin/bash
rsync -az /test/sprin/ /backup/sprin/

Find / Test / SPRIN / SM / F -type -mtime +30 -execdir RM -rf - '{}' +
# - Delete file more than 30 days, in order to continue to make room

find /test/sprin/FA/ -type f -mtime +30 -execdir rm -rf -- '{}' +

Given script execute permissions
chmod + x sprin.sh

A test is performed to see if the error
sh sprin.sh

Edit cron scheduled task
crontab -e

/5 * /root/sprin.sh

# - add time, performed every 5 minutes

crontab -l
sudo service cron restart
sudo service cron status

Guess you like

Origin blog.51cto.com/helpdesk/2423149