Requirements Description:
Today, colleagues asked a question on Linux crontab timed tasks, saying, how to adjust a scheduled task every 2 hours
Executed once, under this record.
Operation Process :
1. Execute the script every 2 hours by setting it up in the following way
0 */2date >>/tmp/time. Log
Note: The star at the beginning of the minute needs to be set to a specific minute value, indicating that a minute is executed every 2 hours, and if it is a star, the default is once per minute.
2. Question thinking, crontab is set to every 2 hours, from the current time, or what?
Crontab The time the modification takes effect is 10:48.
Discover :
The 12:00,14:00,16:00 time is a multiple of 2 and will be executed.
Explanation: from the crontab effective start, the system time hours each encounters a multiple of 2, such as: 12:00,14:00 and so on will execute.
Document creation time: March 29, 2018 11:14:01
In Linux, how do I set up a script every 2 hours?