Recovery and precaution of crontab deletion operation

Source: Internet
Author: User

1, crontab-r Delete operation of the recovery

Statement resolution: CRONTAB-E Edit and Crontab-r Delete, because E, R on the keyboard is next to, once the misoperation crontab-r will delete each user's timed task.

How to retrieve a task: You can view the statement that executes the task by looking for a crontab log file. Then, rebuild the crontab file and restore it.

Log file directory:/var/log.

View methods: ls/var/log/cron*, Cat Cronlog | grep matches keywords, and so on.


2, prevent the false deletion method

Method: The alias is established by Crontab, that is, alias, when the user input crontab is detected, the/usr/bin/cron.sh is invoked to judge the user's operation and avoid accidental deletion.

The realization method of the online script is given: https://yq.aliyun.com/ziliao/78389 for reference.

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.