Requirements: Every 2 minutes the files in the directory / home / backups / balalala backed up to the / home directory
Preparation
1. Create a source directory
#mkdir / home / backups / balalala
create the original file
#touch /home/backups/balalala/first.sh
2, create a backup directory
#mkdir / home
First, write a script have a backup function
- Create a script
#vi /home/backup.sh - Write command
#! / Bin / SH
cp -r / home / backups / balalala / * / home / beifen
# files under / home / backups / balalala directory backup to the next / home / beifen directory - Executes a script file
such as: sh /home/backup.sh