Discussion:
[Spacewalk-list] server says client should be updated, but nothing happens
Guy Matz
7 years ago
Permalink
Hi! In the Spacewalk UI I see:
Software Updates Available *Packages:
<https://spacewalk.schrodinger.com/rhn/systems/details/packages/UpgradableList.do?sid=1000010387>*
6

rhnsd is running on the client but the client does not get updated.
Running 'yum update' on the client would get it to update, but I think
rhnsd is supposed to take care of this for me . . . what do I need to do
to have the client automatically update?

One more question: Is it possible to have a post-update script run?

Thanks a lot!
Guy
David Rock
7 years ago
Permalink
Software Updates Available Packages: 6
rhnsd is running on the client but the client does not get updated. Running 'yum update' on the client would get it to update, but I think rhnsd is supposed to take care of this for me . . .
No. That’s not what rhnsd does. That just checks into the environment and looks for tasks that have been assigned to the client; it doesn’t automatically apply anything. You have to explicitly schedule tasks so when rhnsd connects, it runs the tasks that are waiting for it.
what do I need to do to have the client automatically update?
Short of putting something in cron, not much. You might be able to create a scheduled event, or use the API to set up a task that the client will pick up.
One more question: Is it possible to have a post-update script run?
You could set up a remote execution script as a wrapper that runs your yum update and then afterward have it run something else. I have often used that and applied to a group of systems under SSM in satellite.



David Rock
***@graniteweb.com
Guy Matz
7 years ago
Permalink
So there's no easy way to schedule all machines to update, say once a month
on the first Monday, or something like that? How do you folks generally
schedule and kick off your updates?
...
Bill Howe
7 years ago
Permalink
We use cron to run a "date checker" type script. The date checker script
can add the functionality you describe (first Monday).
The script will determine whether or not to execute a python scheduler
script. (this uses the python API to schedule updates)

The example below executes a date checker script every Monday.
The date checker script then determines if the next day is the first,
second, or third Tuesday of the month.
If so, it runs the scheduler python script to actually schedule the updates
in either Dev, Test, or Prod.

*---- Cron Job ----*
/etc/cron.d/os-updates-checker

#-Target: Run on the Mon before 1st,2nd,3rd Tues of month (Dev,Test,Prod
Patch Days)
00 08 * * mon root /scripts/os-updates/schedule-updates-check.sh

--* Date Check Script: schedule-updates-check.sh* --

#!/bin/bash
# Title: schedule-updates-check.sh
# Description: Determine if Schedule Updates should be run
# The scheduler should run on the Monday before each environment patch
day.
# The updates should be scheduled to deploy on Tuesday at 0800.

# Script to execute (environment is filled in during the if block)
script="/scripts/os-updates/schedule-updates.py --days 1 --group all_"

# Log file
log_file="/var/log/os-updates/schedule-updates-check.log"

echo "==== Log Started: $(date) ====" >> ${log_file}

# If today is Monday AND 1 day from now is >=1 and <=21(1st,2nd,3rd Tue)
if [[ "$(date '+%a')" == "Mon" ]] && [[ $(date +%-d -d "+1 day") -ge 1 ]];
then
# First Tue: Development
if [[ $(date +%-d -d "+1 day") -le 7 ]]; then
echo ">> OK: One day from now is the first Tue of the Month; execute
script(${script}dev)." >> ${log_file}
${script}dev 2>&1 >> ${log_file}

# Second Tue: System Test
elif [[ $(date +%-d -d "+1 day") -le 14 ]]; then
echo ">> OK: One day from now is the second Tue of the Month; execute
script(${script}test)." >> ${log_file}
${script}systest 2>&1 >> ${log_file}

# Third Tue: Production
elif [[ $(date +%-d -d "+1 day") -le 21 ]]; then
echo ">> OK: One day from now is the third Tue of the Month; execute
script(${script}prod)." >> ${log_file}
${script}prod 2>&1 >> ${log_file}

else
echo ">> NO-EXEC: One day from now is NOT the first,second, or third
Tue of the Month. Will NOT execute script(${script})." >> ${log_file}
fi
else
echo ">> NO-EXEC: One day from now is NOT the first,second, or third Tue
of the Month. Will NOT execute script(${script})." >> ${log_file}
fi

echo -e "==== Log Ended: $(date) ====\n" >> ${log_file}
-------


Bill Howe
...
Guy Matz
7 years ago
Permalink
Thanks, but that sounds like a hack. I would think this sort of scheduling
would be a pretty common feature request . . . anyone know if this will
ever be implemented in spacewalk, or if it's been turned down in the past?
...
Joaquin Henriquez
7 years ago
Permalink
Either run rhn_check in a cronjob or install osad.

I personally install osad and packages are install right away.

From: spacewalk-list-***@redhat.com [mailto:spacewalk-list-***@redhat.com] On Behalf Of Guy Matz
Sent: 16 August 2018 15:47
To: spacewalk-***@redhat.com
Subject: EXTERNAL: Re: [Spacewalk-list] server says client should be updated, but nothing happens

Thanks, but that sounds like a hack. I would think this sort of scheduling would be a pretty common feature request . . . anyone know if this will ever be implemented in spacewalk, or if it's been turned down in the past?

On Wed, Aug 15, 2018 at 3:17 PM Bill Howe <***@gmail.com<mailto:***@gmail.com>> wrote:
We use cron to run a "date checker" type script. The date checker script can add the functionality you describe (first Monday).
The script will determine whether or not to execute a python scheduler script. (this uses the python API to schedule updates)

The example below executes a date checker script every Monday.
The date checker script then determines if the next day is the first, second, or third Tuesday of the month.
If so, it runs the scheduler python script to actually schedule the updates in either Dev, Test, or Prod.

---- Cron Job ----
/etc/cron.d/os-updates-checker

#-Target: Run on the Mon before 1st,2nd,3rd Tues of month (Dev,Test,Prod Patch Days)
00 08 * * mon root /scripts/os-updates/schedule-updates-check.sh

-- Date Check Script: schedule-updates-check.sh --

#!/bin/bash
# Title: schedule-updates-check.sh
# Description: Determine if Schedule Updates should be run
# The scheduler should run on the Monday before each environment patch day.
# The updates should be scheduled to deploy on Tuesday at 0800.

# Script to execute (environment is filled in during the if block)
script="/scripts/os-updates/schedule-updates.py --days 1 --group all_"

# Log file
log_file="/var/log/os-updates/schedule-updates-check.log"

echo "==== Log Started: $(date) ====" >> ${log_file}

# If today is Monday AND 1 day from now is >=1 and <=21(1st,2nd,3rd Tue)
if [[ "$(date '+%a')" == "Mon" ]] && [[ $(date +%-d -d "+1 day") -ge 1 ]]; then
# First Tue: Development
if [[ $(date +%-d -d "+1 day") -le 7 ]]; then
echo ">> OK: One day from now is the first Tue of the Month; execute script(${script}dev)." >> ${log_file}
${script}dev 2>&1 >> ${log_file}

# Second Tue: System Test
elif [[ $(date +%-d -d "+1 day") -le 14 ]]; then
echo ">> OK: One day from now is the second Tue of the Month; execute script(${script}test)." >> ${log_file}
${script}systest 2>&1 >> ${log_file}

# Third Tue: Production
elif [[ $(date +%-d -d "+1 day") -le 21 ]]; then
echo ">> OK: One day from now is the third Tue of the Month; execute script(${script}prod)." >> ${log_file}
${script}prod 2>&1 >> ${log_file}

else
echo ">> NO-EXEC: One day from now is NOT the first,second, or third Tue of the Month. Will NOT execute script(${script})." >> ${log_file}
fi
else
echo ">> NO-EXEC: One day from now is NOT the first,second, or third Tue of the Month. Will NOT execute script(${script})." >> ${log_file}
fi

echo -e "==== Log Ended: $(date) ====\n" >> ${log_file}
-------


Bill Howe
***@gmail.com<mailto:***@gmail.com>


On Tue, Aug 14, 2018 at 4:42 PM Guy Matz <***@gmail.com<mailto:***@gmail.com>> wrote:
So there's no easy way to schedule all machines to update, say once a month on the first Monday, or something like that? How do you folks generally schedule and kick off your updates?
Software Updates Available Packages: 6
rhnsd is running on the client but the client does not get updated. Running 'yum update' on the client would get it to update, but I think rhnsd is supposed to take care of this for me . . .
No. That’s not what rhnsd does. That just checks into the environment and looks for tasks that have been assigned to the client; it doesn’t automatically apply anything. You have to explicitly schedule tasks so when rhnsd connects, it runs the tasks that are waiting for it.
what do I need to do to have the client automatically update?
Short of putting something in cron, not much. You might be able to create a scheduled event, or use the API to set up a task that the client will pick up.
One more question: Is it possible to have a post-update script run?
You could set up a remote execution script as a wrapper that runs your yum update and then afterward have it run something else. I have often used that and applied to a group of systems under SSM in satellite.


—
David Rock
***@graniteweb.com<mailto:***@graniteweb.com>





_______________________________________________
Spacewalk-list mailing list
Spacewalk-***@redhat.com<mailto:Spacewalk-***@redhat.com>
https://www.redhat.com/mailman/listinfo/spacewalk-list
_______________________________________________
Spacewalk-list mailing list
Spacewalk-***@redhat.com<mailto:Spacewalk-***@redhat.com>
https://www.redhat.com/mailman/listinfo/spacewalk-list
_______________________________________________
Spacewalk-list mailing list
Spacewalk-***@redhat.com<mailto:Spacewalk-***@redhat.com>
https://www.redhat.com/mailman/listinfo/spacewalk-list

Continue reading on narkive:
Loading...