Cron is a daemon under Linux that is used to perform tasks on a regular basis.
To allow Cron to perform the tasks you specify, you first need to edit the crontab file.
Command: CRONTAB-E
Just go in to hint select an editor, optional, I used to use VIM
You can write tasks that you want to perform periodically in this area.
The format is this:
One line for each job, a total of six fields. In addition, there are some auxiliary characters:
I wrote a regular task for the test,
*/2 * * * Date >> ~/time.log
It means that the date >> ~/time.log command (log the current time to the Time.log file) is executed every two minutes. You can add it to your crontab and then save the exit.
After saving the crontab, we also need to restart Cron to apply this scheduled task. Using commands: sudo service cron restart just OK.
Other examples:
* * * * * * * * * Every minute of the task (min.) 0 * * * * * * * * * * * * * * * 0 points per hour, such as 6:00,10:00 6,10 * 2 * # 2nd per month, 6 minutes and 10 minutes per hour. Perform a task */3,*/5 * * * * * * * * every 3 minutes or 5 minutes, such as 10:03,10:05,10:06