[Spacewalk-list] server says client should be updated, but nothing happens

Bill Howe howe.bill at gmail.com
Wed Aug 15 19:16:57 UTC 2018


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
howe.bill at gmail.com <http://www.linkedin.com/in/whowe>


On Tue, Aug 14, 2018 at 4:42 PM Guy Matz <guymatz at 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?
>
> On Mon, Aug 13, 2018 at 5:25 PM David Rock <david at graniteweb.com> wrote:
>
>>
>> > On Aug 13, 2018, at 16:09, Guy Matz <guymatz at gmail.com> wrote:
>> >
>> > Hi!  In the Spacewalk UI I see:
>> > 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
>> david at graniteweb.com
>>
>>
>>
>>
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20180815/1fc71cb8/attachment.htm>


More information about the Spacewalk-list mailing list