Excellent!!! May I make one suggestion? Add $HOSTNAME in a couple
places, so if you have multiple computers you know which one needs to
be updated.
########################
#!/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 for $HOSTNAME" | mail -s "Updates
Available for $HOSTNAME" root
fi
#########################
--
Matt Shields
http://masnetworks.biz/
http://www.caosity.org/
On Wed, 08 Dec 2004 07:48:03 -0500, Ryan Lane
ryan@rel.dyndns.org wrote:
> 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.
> >
>
> _______________________________________________
> CentOS mailing list
> CentOS@caosity.org
>
http://lists.caosity.org/mailman/listinfo/centos
>