Automatic Backup and Regular deletion of backup in linux

Source: Internet
Author: User
In linux, automatic backup and Regular deletion of backup-Linux Enterprise Application-Linux server application information are provided. For more information, see the following section. Author: yitianya
Today, I just saw a buddy in the group sending such a question on qq, and it feels useful. After asking a few friends from other groups, it's basically done. Write it here for notes.

Question requirements:
Back up all files under/etc to/home/backup every PM. Only the last seven backups are retained. Write process!

1. Write the crontab file.
30 1 ***/root/myshell

2. write the script file/root/myshell.
CODE :#! /Bin/bash
Tar czvf/home/backup/bak.tar.gz/etc
Mv/home/backup/bak.tar.gz bak 'date when using f'.tar.gz
Find/home/backup-mtime 7-type f-exec rm {}\;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.