Yum update notification when logging on to CentOS server remotely
Solution 1:
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.
Solution 2:
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:
#! /bin/sh
UPDATES_COUNT=$(yum check-update --quiet | grep -v "^$" | wc -l)
if [[ $UPDATES_COUNT -gt 0 ]]; then
echo "Updates available: ${UPDATES_COUNT}" > /etc/motd
else
> /etc/motd
fi
I go into more detail on a blog post I wrote some time ago.
Maybe that can be a starting point for you.
Solution 3:
Is there anyway that I can have some notification of how many updates are available, if any, when logging into the terminal via SSH.
Just to offer an alternative, you could run yum check-update
on login with ~/.bash_profile
. Yum-updatesd is made for this, though.