'How to ignore the minute part in cron?
*/41 * 6-20 ? * * *
so I have this cron expression and I want it to send a command every 41 seconds e.g. if it sends a message at 2:00:00 the next message should be sent at 2:00:41 but it also sends a message at 2:01:00 but I don't want it to send a message at 2:01:00 so how can I fix it?
Solution 1:[1]
You have */41 in the minutes specifier - that means every 41st minutes.
# .---------------- 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
# | | | | |
# * * * * *
Since cron does not go down to sub-minute resolutions, you will need to find another way(for eg: you can use sleep)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jeesj |
