Bug #21739

Cron jobs are not disabled for the upgrade

Added by Lukas Zapletal 8 months ago. Updated 3 months ago.

Status:New
Priority:Normal
Assignee:Kavita Gaikwad
Category:Upgrades
Target version:-
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link: Found in Releases:
Pull request:

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
Duplicated by Foreman Maintain - Bug #23461: disable crond Duplicate 04/30/2018

History

#1 Updated by Lukas Zapletal 8 months 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 6 months 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 6 months ago

  • Assignee set to Amit Upadhye

#4 Updated by Lukas Zapletal 6 months ago

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

systemctl status crond

#5 Updated by Lukas Zapletal 6 months 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 6 months ago

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

#7 Updated by Ivan Necas 6 months 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 6 months 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 ?

#9 Updated by Kavita Gaikwad 3 months ago

Lukas and Ivan,

I have one query regarding disabling cron jobs.
Currently, using iptables foreman-maintain set maintenance-mode on/off. so that, it blocks all incoming traffic towards the server.

Would it be good idea to include disable/enable cron-jobs under maintenance-mode itself?

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.

#10 Updated by Kavita Gaikwad 3 months ago

  • Assignee changed from Amit Upadhye to Kavita Gaikwad

#11 Updated by Kavita Gaikwad 3 months ago

Also available in: Atom PDF