I have 3 CentOS 6.3 Virtual Servers that I manage. I have them all set-up and configured, but am notoriously bad with remembering to run yum update
on them from time to time.
Is there anyway that I can have some notification of how many updates are available, if any, when logging into the terminal via SSH. Preferably only if there are updates.
I suspect I need to configure a command to run in .bash_profile
however can't seem to find the correct command using Google.
Hmm. I don't have anything handy that will tell you at logon, but...
You can install
yum-updatesd
and configure it to email you whenever updates are available for the system it's running on. (You could also configure it to download, or download and install, automatically.) You can also have it write to syslog, if you have something monitoring syslog that can pick it up.It can also notify by DBus, so theoretically you could hack together a program to listen for the notification and then change
/etc/motd
appropriately.Personally, I'm a fan of simple solutions without installing unnecessary packages.
I use a simple bash script that checks whether updates are available and modifies my MOTD accordingly (it is run daily by cron). This way you will be notified of available updates each time you log in to your server (if that's not enough, you can easily use the script to send you an email or execute other tasks).
The script could actually not be simpler:
I go into more detail on a blog post I wrote some time ago.
Maybe that can be a starting point for you.
Just to offer an alternative, you could run
yum check-update
on login with~/.bash_profile
. Yum-updatesd is made for this, though.