[CentOS] running yum update on remote servers

Harold Pritchett harold at uga.edu
Wed Feb 27 01:26:44 UTC 2013


On 2/25/2013 9:03 AM, Dennis Jacobfeuerborn wrote:
> On 02/25/2013 02:48 PM, Robert Moskowitz wrote:
>> I have read a couple old threads here on updates for servers, and I am
>> looking for some mechanics to getting the actual updates done.  I don't
>> want automatic updates; I want to control when and what gets updated.
>>
>> First I have to determine that a particular server needs updates.  I
>> suppose a daily script that would run "yum check-updates' and emails me
>> the results could work, but then I would only want the email IF there
>> was something to update, at my limited use of this option does not show
>> anything to trigger a notify on changes.  Does anyone know of a script
>> that would do this?
> A daily cronjob could call "yum check-update" and use the return code to
> decide if the output should be mailed or not. From the yum man-page for
> "check-update":
> "Implemented so you could know if your machine had any updates that needed
> to be applied without running it interactively. Returns exit value of 100
> if there are packages available for an update. Also returns a list of the
> packages to be updated in list format. Returns 0 if no packages are
> available for update. Returns 1 if an error occurred.  Running in verbose
> mode also shows obsoletes."
>
> So redirect the output into a file and when the return code is 100 mail
> that file to the admin.
>
I also like to add the "download-only" plugin to yum so that when I do go back and do the updates, the files are waiting and I don't have to wait around for them to be downloaded.

run "yum install yum-downloadonly"

and the in your script run " /usr/bin/yum --downloadonly -y update"

Hal





More information about the CentOS mailing list