[wplug-internet] Server updates
Vance Kochenderfer
vkochend at nyx.net
Sat Oct 17 21:23:48 EDT 2009
Hi all-
Does anyone have an objection to me adding the below script to
/etc/cron.weekly/ ?
It basically uses yum to check for updates and e-mails root (whose
mail currently goes to Dave O, Dave K, and Mike S) if there are
any. I'm wary of auto-installing updates, which is why I went for
notification instead.
Comments welcome.
Vance Kochenderfer | "Get me out of these ropes and into a
vkochend at nyx.net | good belt of Scotch" -Nick Danger
#!/bin/bash
# This script checks to see if software updates are available from the
# configured repositories and, if so, e-mails root.
# yum check-update sets exit status to indicate availability of updates:
# 0=successful, no updates available
# 1=an error occurred
# 100=successful, updates are available
nice yum check-update > /dev/null 2>&1
update_status="$?"
case $update_status in
0)
exit 0
;;
1)
mail -s "Error - wplug.org update-check" root at wplug.org <<-EOT1
This is the update-check script on wplug.org. The command
'yum check-update' threw an error. You may want to look into it.
EOT1
;;
100)
mail -s "Updates available - wplug.org update-check" root at wplug.org <<-EOT2
This is the update-check script on wplug.org. There are new
software updates available. Please log in and run (as root)
'yum update' to install them. Thanks!
EOT2
;;
*)
mail -s "Weird error - wplug.org update-check" root at wplug.org <<-EOT3
This is the update-check script on wplug.org. The command
'yum check-update' threw an unexpected error code ($update_status).
You may want to look into it.
EOT3
;;
esac
More information about the wplug-internet
mailing list