SUSE Conversations


SMT RPM Lister



By:

December 30, 2009 1:00 pm

Reads:827

Comments:1

Score:Unrated

Print/PDF

License:
Free

Download checkmirrorlog.txt

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:
/etc/smt.d/smt-cron.conf
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
[rpm/x86_64/mozilla-xulrunner191-translations-32bit-1.9.1.6-1.4.1.x86_64.rpm]

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:
“SLES11-Updates/sle-11-x86_64 mozilla-xulrunner191-32bit-1.9.1.6-1.1.1.x86_64.rpm”

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.

bb

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Tags: , ,
Categories: Free Tools, SUSE Linux Enterprise Server, Technical Solutions

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

1 Comment

  1. By:bbendily

    I received this PM from Marcus Menges:
    Thank you for your helpful script, bb, great job, but in our environment (SLES 11 with SMT 1.2) the script doesn’t find new updates because the argument ‘Fetch’ doesn’t appear in the log. I just replaced replaced ‘grep Fetch’ with ‘grep SMT::Mirror::Job’ so it works fine for us.
    Best regards from Germany,
    Marcus Menges

    We are not on SMT 11 yet, so thanks for the tip Marcus.
    bb

Comment

RSS