Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1950825

Summary: Setup complex cron for remote executions tasks.
Product: Red Hat Satellite Reporter: Jaskaran Singh Narula <janarula>
Component: Remote ExecutionAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: aruzicka, ilazkano, lstejska, saydas
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: 2021-04-19 07:17:36 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 Jaskaran Singh Narula 2021-04-19 01:32:04 UTC
Description of problem:

When a complex cron is entered while creating any scheduled remote execution jobs it is unable to allow to create one. 

- Not accepting Complex corn lines as --->> 
[1] * * * * 7 [ $(date +\%d) -le 07 ] && /run/your/script
or 
[2] * * * * 7 [ $(date +\%d) -le 07 ] 


- But can only accept as ------>> * * * * 7

Version-Release number of selected component (if applicable):
Satellite 6.8.x 


How reproducible:
100%

Steps to Reproduce:
1. On the satellite Web UI schedule a remote job and ad the corn line as mentioned above.  
2. It will prompt the error and will not allow submitting the form. 


Actual results:
While submitting the form to schedule a remote job below error can be seen. 

Error:
----------
* * * * 7 [ $(date +\%d) -le 07 ] is not valid format of cron line
-----------

Expected results:
It should allow users to submit complex crons lines. 


Additional info:

Comment 1 Adam Ruzicka 2021-04-19 07:17:36 UTC
There is not such thing as a "complex cron line". A cron line is a set of 5 timing fields and anything that follows is a command.

In your example "* * * * 7 [ $(date +\%d) -le 07 ] && /run/your/script", the timing part is only "* * * * 7". The "[ $(date +\%d) -le 07 ] && /run/your/script" is a command. It fires every sunday and the as part of the thing being run it either exits early (if it is not the first week) or runs the script.

You can mimic the same behavior with remote execution as is, just note that the "exit early or continue" will be evaluated on each of the target hosts separately.

Comment 2 Imanol Lazkano 2021-05-07 10:11:54 UTC
Hi!

I assume the restriction here is the use of cron for the scheduling. Would it make sense to create an RFE to improve this behavior at Satellite level so we can do the "first Monday of the month" or "third Sunday of the month" for monthly schedules?

The thing is, most likely these activities will happen outside of business hours, and this implies the ability to determine a cadence (monthly, or even yearly, or more complex by-monthy...) that can honor the day of the week.

Would it be possible? Can an RFE be opened for this purpose?

Thanks,

Imanol