This script will parse the SMT server’s log and output a list of RPMs that have been updated.
First, you need to enable debug logging on your SMT mirror log.
On your SMT server, edit:
Add the “-d” to the variable listed below:
MIRROR_PARAMS=”-d -L /var/log/smt-mirror.log”
This will add extra details to your SMT mirror log. For example:
2009-12-22 03:56:27 SMT::Mirror::Job – [debug] Fetch
This gives us the date/time the file was downloaded and the name and part of the location of the file. This doesn’t actually tell us what OS and patch level the file is for.
So, to find this, I run a locate command and the parse the output so it looks good to me.
You may also want to edit your crontab file and add a few entries, but these depend on the time your run your SMT sync. We run the sync at 1am. This usually completes with the daily updates by 4-5am.
At 7:45am I run the built-in updatedb command by SuSE.
(You need to install the findutils and findutils-locate RPMs for this to work properly.)
And then at 8am I run my script.
Edit: /etc/crontab (and add the two entries below)
45 7 * * * root /etc/cron.daily/suse.de-updatedb
0 8 * * * root /etc/checkmirrorlog.sh
The script has a couple of variables you’ll want to check, the date command format and the log file location.
The default date format is: 2009-12-22
and the default log file location is: /var/log/smt-mirror.log
First the script checks to see if any new files were downloaded today. If not, it will echo
“No SMT Updates available…”
If updates are available you will get an output that looks like:
A few things to note, in our environment, I don’t really want to know about s390 updates, or deltas, patch, src or anything in our testing environment. If you want to include those you’ll have to edit both of the grep commands.
By default, I have disabled the emailing and writing to your log, but you can uncomment those two lines to have the script send an email of the listing as well as write a “completed” entry to your messages log.
As you will notice, I have saved the file as /etc/checkmirrorlog.sh, in order to execute the file you’ll want to set the execute permissions:
chmod 755 /etc/checkmirrorlog.sh
Please let me know if there are any questions regarding this script.