Bug #21739

Cron jobs are not disabled for the upgrade

Added by Lukas Zapletal 2 months ago. Updated 9 days ago.

Status:New
Priority:Normal
Assigned To:Amit Upadhye
Category:Upgrades
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

Our HTB customer noticed that cron jobs are not disabled prior upgrade:

CROND[16357]: (foreman-proxy) CMD> (smart-proxy-openscap-send >> /var/log/foreman-proxy/cron.log)
CROND[16358]: (foreman) CMD (/usr/sbin/foreman-rake ldap:refresh_usergroups >>/var/log/foreman/cron.log 2>&1)
CROND[16359]: (foreman) CMD (/usr/sbin/foreman-rake trends:counter >>/var/log/foreman/cron.log 2>&1)

I think we should stop crond completely, but there can still be systemd timer events.


Related issues

Related to Foreman Maintain - Feature #22198: foreman-maintain maintenance-mode command New 01/09/2018

History

#1 Updated by Lukas Zapletal about 1 month ago

Here is an idea, when Satellite is in maintenance mode, create /sat-maintenance file or something. If that's present, cron jobs can be all skipped.

#2 Updated by Amit Upadhye 16 days ago

Lukas Zapletal wrote:

Here is an idea, when Satellite is in maintenance mode, create /sat-maintenance file or something. If that's present, cron jobs can be all skipped.

As per discussion with Lukas below we will try to implement,

1. We will check if Satellite is in maintenance mode ?
2. If its in maintenance mode we will exit all crons with exit code zero. Here we will make changes in below files,

  1. this will be first line all cron jobs
    if -f /var/xxx && exit 0

/etc/cron.d/foreman
/etc/cron.daily/katello-repository-publish-check
/etc/cron.weekly/katello-clean-empty-puppet-environments
/etc/cron.weekly/katello-remove-orphans

My questions is, how we should know if Satellite is in maintenance mode ?

1. We are already creating a iptables chain 'FOREMAN_MAINTAIN' so should we just check if this chain exists, and if this is there then exit cron jobs ?
2. Should we create an maintain new file will will be in /var/lib/foreman-maintain/ directory which will help to know if Satellite is in maintenance mode ?

Thank You,
Amit Upadhye.

#3 Updated by Amit Upadhye 15 days ago

  • Assigned To set to Amit Upadhye

#4 Updated by Lukas Zapletal 15 days ago

Isn't just stopping cron daemon sufficient? That could do it easily.

systemctl status crond

#5 Updated by Lukas Zapletal 15 days ago

IMHO there must be a utility that allows you to enter, exit and test maintainance mode:

foreman-maintainance start

foreman-maintainance check
echo $?
1

foreman-maintainance stop

foreman-maintainance check
echo $?
0

#6 Updated by Ivan Necas 15 days ago

  • Related to Feature #22198: foreman-maintain maintenance-mode command added

#7 Updated by Ivan Necas 15 days ago

Agreed, we've been tracking this in https://bugzilla.redhat.com/show_bug.cgi?id=1487559, I hope to get this one prioritized properly.

#8 Updated by Amit Upadhye 9 days ago

Lukas Zapletal wrote:

IMHO there must be a utility that allows you to enter, exit and test maintainance mode:

[...]

One more thing is, if user do not upgrade using foreman-maintain then should we check for 'satellite-installer' process in 'ps' and if its running then exit cronjob ? Because with forman-maintain we have pre scripts which will handle stopping crond service but if user just runs 'satellite-installer' then crond would be running ?

Also available in: Atom PDF