Project

General

Profile

Actions

Bug #21739

closed

Cron jobs are not disabled for the upgrade

Added by Lukas Zapletal over 6 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Category:
Upgrades
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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 2 (0 open2 closed)

Related to Foreman Maintain - Feature #22198: foreman-maintain maintenance-mode commandClosedKavita GaikwadActions
Has duplicate Foreman Maintain - Bug #23461: disable crondDuplicate04/30/2018Actions
Actions #1

Updated by Lukas Zapletal over 6 years 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.

Actions #2

Updated by Amit Upadhye about 6 years 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.

Actions #3

Updated by Amit Upadhye about 6 years ago

  • Assignee set to Amit Upadhye
Actions #4

Updated by Lukas Zapletal about 6 years ago

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

systemctl status crond

Actions #5

Updated by Lukas Zapletal about 6 years 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
Actions #6

Updated by Ivan Necas about 6 years ago

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

Updated by Ivan Necas about 6 years 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.

Actions #8

Updated by Amit Upadhye about 6 years 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 ?

Actions #9

Updated by Kavita Gaikwad almost 6 years 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.

Actions #10

Updated by Kavita Gaikwad almost 6 years ago

  • Assignee changed from Amit Upadhye to Kavita Gaikwad
Actions #11

Updated by Kavita Gaikwad almost 6 years ago

Actions #12

Updated by Kavita Gaikwad almost 4 years ago

  • Status changed from New to Resolved

Resolved as a part of feature maintenance-mode command - https://projects.theforeman.org/issues/22198

Actions

Also available in: Atom PDF