Linux planning tasks Introduction

  
 

Everyone has more or less appointments or jobs, and some jobs are planned, such as an annual salary increase, a monthly work report, a weekly lunch report, and daily needs. Punch card, etc.; some jobs are temporary, such as the company has a senior official visit, you need to prepare speech equipment and so on! Used in life, such as the birthday of the lover every year, the wake-up time every day, etc., as well as sudden computer price cuts (ah! I really hope every day!) Wait a minute.

Like these plans, usually you have to record on the calendar to avoid forgetting! However, because we are often in front of the computer, if the computer
system can actively inform us, then it is not much easier! Hey! At this time, Linux's planned work plan tasks can be sent to play! Without considering the connection between the hardware and our server, our Linux can help you remind a lot of tasks, for example: 8:00 every morning to connect the server to the sound, and start music to wake you up; 12:00 noon I hope that Linux can send a letter to your email box to remind you that you can go to lunch. In addition, on the day before your lover's birthday every year, you should send a letter to remind you to avoid forgetting such an important day.

So how does Linux planning work for planning tasks? The so-called planning task is the process of arranging the work of these tasks! Our Linux plan is to use crontab and at two! What are the similarities between these two things? Let us come first!


Types of Linux Scheduled Tasks: at, cron

From the above description, we can clearly see the two ways of planning tasks:

● One is planned, that is, things to be done at regular intervals;

● One is sudden, that is, the one that is not available after this time (computer Big price cut …)

So how do you achieve these two functions under Linux? Then you have to use at and crontab these two good things!

● at :at is an instruction that can process a scheduled task only once, but to execute at, you must have support for the atd service. In some new distributions, atd may not be started by default, then the at command will be invalid! But our CentOS preset is up!

● crontab : crontab The work set by this command will continue to loop! The time that can be cycled is minutes, hours, weekly, monthly or yearly. In addition to the command execution, crontab can also be edited by editing /etc/crontab. As for the service that makes crontab work, it is crond service!

Let's talk about what the Linux system is doing, how do you have a number of planned tasks? Then come back and talk about the two good things at and crontab!

Commonly Scheduled Tasks on Linux

If you have used Linux for a while, then you will probably find that Linux will actively help us with some work! For example, automatic online update (on-line update), automatic updateb update file name database, automatic log analysis (so root often receives a message titled logwatch) and so on. This is due to the fact that the system must be operated normally, and some work in the background must be scheduled. Basically, the common tasks for Linux systems are:

● Log rotate:

Linux will actively record all kinds of information generated by the system. This is Log. Since the system will always log login information, the login file will be bigger and bigger! We know that large files not only account for the capacity, but also cause the efficiency of reading and writing. Therefore, it is better to record the login data in a timely manner, so that the old data and the new data are stored separately. This is the task of log rotate! This is also the necessary planning task for the system;

● Logging files to analyze logwatch tasks:

If there are software problems, hardware errors, security issues, etc., most of the error messages will be It is recorded in the login file, so one of the important tasks of the system administrator is to analyze the login file. But you can't manually view the login file through software such as vim, because the data is too complicated! Our CentOS provides a program "logwatch" to proactively analyze login information, so you will find that your root will always receive a message titled logwatch, which is normal! You'd better be able to see the contents of the letter too!

●Create a database for locate:

We know that the command is to query the file name on the system through the existing file name database. Our file name database is placed in /var/lib/mlocate/. The question is, how is this database automatically updated? Hey! This is the effect of the system's planning work! The system will actively updateb!

●Whatis database is established:

Similar to the locate database, whatis is also a database. This whatis is a query command related to the man page, but when using the whatis command, you must Have a whatis database, and this database is also automatically executed through the system's planned work plan tasks!

● RPM software login file creation:

RPM is a software management mechanism. Because the system may change the software frequently, including new installations of software, non-recurring updates, etc., will cause differences in software file names. In order to facilitate future tracking, the system also helps us to sort the file names into records! Sometimes the system will also help to rebuild the RPM database through scheduled tasks!

● Delete cache files:

Some software will generate some cache during operation, but when the software is closed, these caches may not be deleted actively. Some scratch disks are time-based. If it is more than a certain period of time, this cache will not work. It is an important task to delete these caches at this time! Otherwise the disk capacity will be consumed. The system deletes these cache files by scheduling a work plan task to execute an instruction called tmpwatch!

● Analytical behavior related to web services:

If you have a WWW-like server software (a software called apache) installed, your Linux system will usually analyze it automatically. Software login file. At the same time, if some of the credentials and the authenticated network information are out of date, our Linux system will also help you to check automatically!

In fact, the planning work that your system will carry out is related to the amount of software you install. If you install too much software, some software functions will be accompanied by analysis tools, then your system will have more Some planning work! The host of Bird Brother also added a lot of analysis tools written by myself, as well as analysis software of other third-party collaborative software, hehe! Awkward Linux workload is very big! Because there is so much work to do, we certainly have to understand how the planning work is handled!

Copyright © Windows knowledge All Rights Reserved