Bug #21739
closed
Cron jobs are not disabled for the upgrade
Added by Lukas Zapletal over 6 years ago.
Updated almost 4 years ago.
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.
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.
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.
- Assignee set to Amit Upadhye
Isn't just stopping cron daemon sufficient? That could do it easily.
systemctl status crond
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
- Related to Feature #22198: foreman-maintain maintenance-mode command added
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 ?
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.
- Assignee changed from Amit Upadhye to Kavita Gaikwad
- Status changed from New to Resolved
Also available in: Atom
PDF