Wednesday, March 10, 2010

CentOS / RHEL Configure Yum Automatic Update Retrieval and Installation

from this blog we can do the following:

Create this script to update the system:

#!/bin/bash
/usr/bin/yum -y -R 120 -d 0 -e 0 update yum
/usr/bin/yum -y -R 10 -e 0 -d 0 update

and save it to this folder:
/etc/cron.daily/yumupdate.sh to apply updates one a day.
/etc/cron.weekly/yumupdate.sh to apply updates once a week.

First command will update yum itself and next will apply system updates.
-R 120 : Sets the maximum amount of time yum will wait before performing a command
-e 0 : Sets the error level to 0 (range 0 - 10). 0 means print only critical errors about which you must be told.
-d 0 : Sets the debugging level to 0 - turns up or down the amount of things that are printed. (range: 0 - 10).
-y : Assume yes; assume that the answer to any question which would be asked is yes.

Make sure you setup executable permission:
chmod +x /etc/cron.daily/yumupdate.sh

No comments:

Post a Comment