Creating a cron job to run at hour mark and half hour mark for specific hours on specific day of week

StackOverflow https://stackoverflow.com/questions/17083348

I need to setup cron jobs so that they run at 1800, 1830, 1900, 1930, 2000, 2030, 2100 on every Monday and Thursday. So far I've managed to get to this:

00,30 18-21 * * 1,4

Is this the right way of doing it? If yes, will it run on 21:30 as well?

有帮助吗?

解决方案

Your cronjob will run at 21.30 as well. To avoid it, you'd better split it in two pieces:

00,30 18-20 * * 1,4     # 1800, 1830, 1900, 1930, 2000, 2030
00 21 * * 1,4           # 2100
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top