Requirements: a backup file every 2 minutes.

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

  1. Create a script
    #vi /home/backup.sh
  2. Write command
    #! / Bin / SH
    cp -r / home / backups / balalala / * / home / beifen
    # files under / home / backups / balalala directory backup to the next / home / beifen directory
  3. Executes a script file
    such as: sh /home/backup.sh

Guess you like

Origin blog.51cto.com/14413105/2435305