Crond is a command that Linux uses to execute programs on a regular basis. This task Dispatch command is started by default when the operating system is installed. The Crond command periodically checks to see if there is any work to be done and the work will be performed automatically if there is work to be done. You can start and close this service in the following ways:
[[email protected] ~]#/sbin/service crond start
[[email protected] ~]#/sbin/service Crond stop off
stopping Crond: [OK]
[[email protected] ~]#/sbin/service crond start
Starting Crond: [OK]
[[email protected] ~]#/sbin/service crond restart reboot
stopping Crond: [OK]
Starting Crond: [OK]
[[email protected] ~]#/sbin/service Crond Reload Reload Configuration
Reloading Crond: [OK]
The task scheduling under Linux is divided into two categories, system task scheduling and user task scheduling.
System Task Scheduling : The work to be performed by the system periodically, such as writing cache data to hard disk, log cleanup, etc.
In the/etc directory there is a crontab file, this is the System Task Scheduler configuration file.
[email protected] ~]# Cat/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
home=/
# for details see Mans 4 Crontabs
# for details see Mans 4 Crontabs
# Example of Job definition:
#.----------------Minute (0-59)
# | .-------------Hour (0-23)
# | | .----------Day of Month (1-31)
# | | | .-------month (1-12) OR jan,feb,mar,apr ...
# | | | | .----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * * user-name command to be executed
The first line of the shell variable specifies which shell the system will use, and this is bash
The second line of PATH variable specifies the path of the System execution command
The third line of the mailto variable specifies that Crond's task execution information will be emailed to the root user, and if the value of the mailto variable is null, the task execution information is not sent to the user
The four-row home variable specifies the home directory to use when executing the command or script.
User Task Scheduling : Tasks that users perform on a regular basis, such as user data backup. Users can use the Crontab tool to customize their own scheduled tasks.
All user-defined crontab files are saved in the/var/spool/cron directory. Its file name is the same as the user name.
Linux Add Scheduled Tasks