Regular cleanup 2 weeks ago The specified directory specifies the suffix of the file at the specified level

Source: Internet
Author: User

0 2 * * * find/tftpboot-maxdepth 1-mtime +14-name "*.img"-exec rm-rf {} \;


Every 2 hours, go to search/tftpboot This level directory, the modification time is 14 days ago, suffix is img file, and delete them one by one;



crontab command format
Basic format:
* * * * * command
Time-sharing Weekly command

The 1th column represents minutes 1~59 per minute with * or */1
The 2nd column represents the hour 1~23 (0 means 0 points)
The 3rd column represents the date 1~31
The 4th column represents the month 1~12
5th Column Identification Number Week 0~6 (0 = Sunday)
6th List of commands to run


Command
Find/tftpboot-maxdepth 1-mtime +15-name "*.img"-exec rm-rf {} \;
Find/tftpboot-maxdepth 1-mtime +15-name "*.img"
Find/tftpboot This level directory, file modification time is 15 days ago, suffix. img file name,
-exec RM-RF {}
Once found, delete each found file;
\; It's a grammatical requirement, no special meaning.

Regular cleanup 2 weeks ago The specified directory specifies the suffix of the file at the specified level

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.