Bug 1571446
Summary: | Cron jobs for every second sunday does not work. | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Shivdutt Bharadwaj <shbharad> |
Component: | Remote Execution | Assignee: | satellite6-bugs <satellite6-bugs> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.3.0 | CC: | aruzicka, inecas |
Target Milestone: | Unspecified | ||
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-04-25 08:10:09 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Shivdutt Bharadwaj
2018-04-24 20:03:02 UTC
From man 5 crontab: """ Note: The day of a command's execution can be specified in the following two fields — 'day of month', and 'day of week'. If both fields are restricted (i.e., do not contain the "*" character), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. """ According to this the cronline you provided would run a job at 4AM every day from 8th to 14th and on every Sunday. Reading the customer case it seems they were reading upstream documentation where this case is described with an error and I'll fix it there. The only way they could do it would be to have the job run on every day from 8th to 14th and start the script with a check for the day of the week and exiting early in case the day of the week is not Sunday, which roughly translates to what they were doing on RHEL with 0 4 8-14 * * [[ date +%a == "Sun" ]] && echo "some task". The manpage piece leads me to believe our implementation adheres to the de-facto standard and we shouldn't deviate from it. I'll close this bug now, please feel free to reopen it if you feel strongly about it. As mentioned, 0 4 8-14 * * [[ date +%a == "Sun" ]] && echo "some task" works for rhel but not on satellite via cronline. Is there any way to execute job on second Sun of every month? 0 4 8-14 * * [[ date +%a == "Sun" ]] can be roughly translated to "on days matching 0 4 8-14 * *" run "[[date +%a == 'Sun' ]] && somescript". You can do exactly the same in satellite, you specify a job with "0 4 8-14 * *" cronline and prefix the executed script with if [[ date %a == 'Sun' ]]; then # The actual script goes here fi So on every day from the 8th to the 14th the job will run against the host and check if it is the right day, in which case it will do what is needed, otherwise it will skip it and exit. In other words, you have to split the cronline you would specify on RHEL into two parts, into the time specification (the first five fields) and the command (the rest). |