<div dir="ltr"><div>We use cron to run a "date checker" type script. The date checker script can add the functionality you describe (first Monday).</div><div>The script will determine whether or not to execute a python scheduler script. (this uses the python API to schedule updates)</div><div><br></div><div>The example below executes a date checker script every Monday.</div><div>The date checker script then determines if the next day is the first, second, or third Tuesday of the month.</div><div>If so, it runs the scheduler python script to actually schedule the updates in either Dev, Test, or Prod.<br></div><div><br></div><div></div><div><b>---- Cron Job ----</b><br></div><div>/etc/cron.d/os-updates-checker<br><br>#-Target: Run on the Mon before 1st,2nd,3rd Tues of month (Dev,Test,Prod Patch Days)<br>00 08 * * mon  root  /scripts/os-updates/schedule-updates-check.sh<br><br>--<b> Date Check Script: schedule-updates-check.sh</b> --<br><br>#!/bin/bash<br># Title: schedule-updates-check.sh<br># Description: Determine if Schedule Updates should be run<br>#   The scheduler should run on the Monday before each environment patch day.<br>#   The updates should be scheduled to deploy on Tuesday at 0800.<br><br># Script to execute (environment is filled in during the if block)<br>script="/scripts/os-updates/schedule-updates.py --days 1 --group all_"<br><br># Log file<br>log_file="/var/log/os-updates/schedule-updates-check.log"<br><br>echo "==== Log Started: $(date) ====" >> ${log_file}<br><br># If today is Monday AND 1 day from now is >=1 and <=21(1st,2nd,3rd Tue)<br>if [[ "$(date '+%a')" == "Mon" ]] && [[ $(date +%-d -d "+1 day") -ge 1 ]]; then<br>  # First Tue: Development<br>  if [[ $(date +%-d -d "+1 day") -le 7 ]]; then<br>    echo ">> OK: One day from now is the first Tue of the Month; execute script(${script}dev)." >> ${log_file}<br>    ${script}dev 2>&1 >> ${log_file}<br><br>  # Second Tue: System Test<br>  elif [[ $(date +%-d -d "+1 day") -le 14 ]]; then<br>    echo ">> OK: One day from now is the second Tue of the Month; execute script(${script}test)." >> ${log_file}<br>    ${script}systest 2>&1 >> ${log_file}<br><br>  # Third Tue: Production<br>  elif [[ $(date +%-d -d "+1 day") -le 21 ]]; then<br>    echo ">> OK: One day from now is the third Tue of the Month; execute script(${script}prod)." >> ${log_file}<br>    ${script}prod 2>&1 >> ${log_file}<br><br>  else<br>    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}<br>  fi<br>else<br>  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}<br>fi<br><br>echo -e "==== Log Ended: $(date) ====\n" >> ${log_file}<br></div><div>-------<br></div><div><br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="color:rgb(0,0,153)">Bill Howe</span><br style="color:rgb(0,0,153)"><span style="color:rgb(0,0,153)"><a href="mailto:howe.bill@gmail.com" target="_blank">howe.bill@gmail.com</a></span><span style="color:rgb(0,0,153)"><a href="http://www.linkedin.com/in/whowe" target="_blank"></a></span><br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 14, 2018 at 4:42 PM Guy Matz <<a href="mailto:guymatz@gmail.com">guymatz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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?<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 13, 2018 at 5:25 PM David Rock <<a href="mailto:david@graniteweb.com" target="_blank">david@graniteweb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Aug 13, 2018, at 16:09, Guy Matz <<a href="mailto:guymatz@gmail.com" target="_blank">guymatz@gmail.com</a>> wrote:<br>
> <br>
> Hi!  In the Spacewalk UI I see:<br>
> Software Updates Available    Packages: 6<br>
> <br>
> 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 . . .  <br>
<br>
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.<br>
<br>
> what do I need to do to have the client automatically update?<br>
<br>
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.<br>
<br>
> One more question:  Is it possible to have a post-update script run?<br>
<br>
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.<br>
<br>
<br>
— <br>
David Rock<br>
<a href="mailto:david@graniteweb.com" target="_blank">david@graniteweb.com</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Spacewalk-list mailing list<br>
<a href="mailto:Spacewalk-list@redhat.com" target="_blank">Spacewalk-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/spacewalk-list</a></blockquote></div>
_______________________________________________<br>
Spacewalk-list mailing list<br>
<a href="mailto:Spacewalk-list@redhat.com" target="_blank">Spacewalk-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/spacewalk-list</a></blockquote></div>