[Centos] confession

Wed Dec 8 12:48:03 UTC 2004
Ryan Lane <ryan at rel.dyndns.org>

Hey all,

Since we are on the yum topic...I have a little shell script that I put 
in /etc/cron.daily/, that checks for updates and emails root if updates 
are available.  Otherwise, if no updates are available, it is silent. 
Here it is:

########################
#!/bin/sh

PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

yum check-update >>/dev/null
STATUS=$?

if [ "$STATUS" -eq 100 ]; then
         echo "CentOS RPM updates are available" | mail -s "Updates 
Available" root
fi
#########################

If you want it to actually email your personal email address, either 
change "root" to your email address, or better yet -- set up 
/etc/aliases to forward root's email to your personall address.  If you 
do that be sure to run newaliases when you are done editing that file.

-Ryan

Matt Shields wrote:
> Here are a few starters commands, these are the most common.
> 
> yum check-update (check to see if any packages need updating)
> 
> yum update  (updates any/all packages that need it)
> yum update packagename1 packagename2 (only update packagename1 & 2)
> 
> yum install packagename1 (installs packagename)
> yum install packagename (same as above but does not prompt you for confirmation)
> 
> yum list available | grep -i packagename  (checks to see if
> packagename is available at yum server)
> 
> yum search packagename (useful if you're not sure the name of the
> package, ie. httpd vs apache, RedHat names the Apache package httpd)
> 
> yum info packagename (similar to rpm -qi, give you info on packagename)
> 
> yum upgrade (I've only used this once, upgrading a test system running
> RHEL 3ES to CentOS, seems like if you point your Yum conf to a
> different distro's yum repo it will upgrade to that version, probably
> also useful for upgrade from CentOS2 to CentOS3)
> 
> For install, update, and upgrade, you can pass it the -y variable and
> it won't prompt you to confirm your actions.  You can also customize
> your yum.conf to exclude certain packages from update/upgrade like the
> kernel.  You can also specify that some packages(again kernel) only
> get installed and not upgraded.
>