Differences between at and cron automation in Linux

Source: Internet
Author: User
Article Title: Similarities and Differences between at and cron automation in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In a Linux operating system, administrators can use certain means to require the system to automatically execute certain work at a specific time, date, or when the average load of the system is relatively low. Generally, the at and cron commands can be used to automate jobs. These two commands can be used by both administrator and common users. For example, the root administrator can use automated job management to perform regular data backup, monitor system stability and performance parameters, and so on. Common users can also use this mechanism to require the system to perform work automatically, such as automatic execution of a script.

Although both commands can meet the requirements of automation, there are many differences between them. The system administrator should select an appropriate implementation method based on the characteristics of the two commands and the purpose they need to achieve.

 1. at command permission control.

The At command is mainly used to schedule specific jobs to be executed At a specific time. When the system administrator or user needs to execute a script at a certain time, the at command can be used to implement this requirement. However, unlike the cron command, the system designer provides a special protection mechanism for the at command. The operating system uses the at. allow and at. deny files to limit which users can use the at command and which users cannot.



For example, the two files are saved in the/etc folder by default. The format of these two access control files is to set a user name in each row, and the existence of space characters is not allowed in both files. If the system administrator needs to restrict the use of the at command for security reasons, you can enter the corresponding username in the at. deny control file. After the access control file is modified, it takes effect immediately. That is, the restriction does not need to restart the system process to take effect. In addition, the previously set at Command will also become invalid. This is mainly because the access control file takes effect when the system executes the at command. In addition, the system administrator cannot use these two files to restrict the permissions of the root account. The Root account can execute at commands at any time, even if the account has been blacklisted for the at. deny access control file.

Readers may find that an account exists in both files. Or the system has two users, A and B. In the at. allow account, only A is allowed to use the at command, and in the at. deny access control file, only A is allowed to use the at command. What is the final result? Will there be conflicts? The system uses priority control methods to avoid conflicts. For example, if the Operating System Administrator defines these two files at the same time, the system will ignore the existence of the at. deny access control file. In other words, the operating system only considers the content in the at. allow file. In the above two examples, the system will run user A to execute the at command (including the root user ). Other users do not have permission to execute the at command.

There is no such restriction on cron automation commands. This is mainly because these two commands are implemented by different designers. This is also a feature of the Linux operating system. It is an operating system built by small commands. There are many other similar cases in Linux. This is also the biggest difference between the two commands.

[1] [2] [3] [4] Next page

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.