crontab run every 15 minutes between certain hours

LinuxCronCrontabSchedule

Linux Problem Overview


Is this correct scheduled to run between 07:00 and 19:00 at every 15 minutes?

*/15    07-19        *     * *     /path/script

Linux Solutions


Solution 1 - Linux

Your command is fine!

To run from 7.00 until 19.45, every 15 minutes just use */15 as follows:

*/15    07-19        *     * *     /path/script
^^^^    ^^^^^

That is, the content */15 in the minutes column will do something every 15 minutes, while the second column, for hours, will do that thing on the specified range of hours.

If you want it to run until 19.00 then you have to write two lines:

*/15    07-18        *     * *     /path/script
0          19        *     * *     /path/script

You can have a full description of the command in crontab.guru: https://crontab.guru/#/15_7-19_**

Solution 2 - Linux

Yes, that's correct.

The entry in crontab would should be:

*/15 7-19 * * * /path/script >/dev/null 2>&1

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncatalinView Question on Stackoverflow
Solution 1 - LinuxfedorquiView Answer on Stackoverflow
Solution 2 - LinuxSion WilliamsView Answer on Stackoverflow