Skip to content

Fixes #39089 - Migrate Foreman cron.d to use Foreman::Cron framework#13001

Open
archanaserver wants to merge 1 commit intotheforeman:rpm/developfrom
archanaserver:update-cron-entrypoints
Open

Fixes #39089 - Migrate Foreman cron.d to use Foreman::Cron framework#13001
archanaserver wants to merge 1 commit intotheforeman:rpm/developfrom
archanaserver:update-cron-entrypoints

Conversation

@archanaserver
Copy link

Replace individual task cron entries with consolidated cron:hourly, cron:daily, cron:weekly, and cron:monthly entrypoints. This leverages the Foreman::Cron framework to manage recurring tasks centrally, allowing plugins to register tasks without modifying cron files.

@archanaserver archanaserver requested a review from a team as a code owner February 10, 2026 06:46
@archanaserver archanaserver force-pushed the update-cron-entrypoints branch 2 times, most recently from 2e02756 to 6d59d98 Compare February 10, 2026 07:09
Copy link
Member

@ogajduse ogajduse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this patch deserves a Redmine issue. Would you mind creating one?

There is not much to review from the packaging standpoint. I'd prefer someone from the Rocket team review this PR.

Replace individual task cron entries with consolidated cron:hourly,
cron:daily, cron:weekly, and cron:monthly entrypoints. This leverages
the Foreman::Cron framework to manage recurring tasks centrally,
allowing plugins to register tasks without modifying cron files.
@archanaserver archanaserver force-pushed the update-cron-entrypoints branch from 6d59d98 to 8686586 Compare February 18, 2026 20:11
@archanaserver archanaserver changed the title Migrate Foreman cron.d to use Foreman::Cron framework Fixes #39089 - Migrate Foreman cron.d to use Foreman::Cron framework Feb 18, 2026
@archanaserver
Copy link
Author

I'd say this patch deserves a Redmine issue. Would you mind creating one?

Here it is - https://projects.theforeman.org/issues/39089

Copy link
Member

@ogajduse ogajduse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Archana.
Pending review from Rocket team.

Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a revision bump and changelog entry in `foreman.spec.

But conceptually ACK, this is what we want to move towards.

# Clean up the session entries in the database
15 23 * * * foreman /usr/sbin/foreman-rake db:sessions:clear 2>&1 | gawk '{ print strftime("[\%Y-\%m-\%d \%H:\%M:\%S]"), $0 }' >>/var/log/foreman/cron.log
# Run hourly Foreman cron jobs
*/30 * * * * foreman /usr/sbin/foreman-rake cron:hourly 2>&1 | gawk '{ print strftime("[\%Y-\%m-\%d \%H:\%M:\%S]"), $0 }' >>/var/log/foreman/cron.log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trigger twice an hour: 0 and 30, you probably want

Suggested change
*/30 * * * * foreman /usr/sbin/foreman-rake cron:hourly 2>&1 | gawk '{ print strftime("[\%Y-\%m-\%d \%H:\%M:\%S]"), $0 }' >>/var/log/foreman/cron.log
30 * * * * foreman /usr/sbin/foreman-rake cron:hourly 2>&1 | gawk '{ print strftime("[\%Y-\%m-\%d \%H:\%M:\%S]"), $0 }' >>/var/log/foreman/cron.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants