Bug #21739
closedCron jobs are not disabled for the upgrade
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.
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.
Updated by Amit Upadhye over 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,
- 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.
Updated by Lukas Zapletal over 6 years ago
Isn't just stopping cron daemon sufficient? That could do it easily.
systemctl status crond
Updated by Lukas Zapletal over 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
Updated by Ivan Necas over 6 years ago
- Related to Feature #22198: foreman-maintain maintenance-mode command added
Updated by Ivan Necas over 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.
Updated by Amit Upadhye over 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 ?
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.
Updated by Kavita Gaikwad almost 6 years ago
- Assignee changed from Amit Upadhye to Kavita Gaikwad
Updated by Kavita Gaikwad almost 6 years ago
- Has duplicate Bug #23461: disable crond added
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