Adam Goucher wrote:

> > BTW: I don't log rpm installs/updates, *if* I run them the default way:
> > this because I get info on them very quickly by simply doing a
> > 'rpm -qa --last' ... the lazy method :) ... oops: this just gives me the
> > idea of doing a 'rpm -qa --last > log file' next time .. just in case the
> > rpm database, or whatever produces this log, will break ... :)
>
> I think for a logbook you would want to do 'rpm -qa --last >> log' else
> you will only ever have your last --last. :)

Now you guys have me thinking, and that is always dangerous.  I have for
sometime wanted to track the actual filename and location where a particular
package was installed from and logging it never actually occurred to me.  What
would be the downside to writing a shell script wrapper that would concatenate
to a  log file some of that information and the output generated by rpm.

Some thing like:

#!/bin/sh
# usage:  logrpm [optionstorpm] path/to/rpmfile
outlog="/var/log/logrpm.log"
#send all stdout to file
exec > $outlog
echo $(date)" beginning installation using commandline args as follows:"
echo $*
echo "current working directory is $(pwd)"
if ( eval rpm $*) then
    echo "rpm command completed sucessfully"
else
    # print url of output log incase we run this in cron and wnat to get a
mail that willl point to the machine it is on
    echo " rpm command failed.  see http://$HOSTNAME/$outlog for details " >
/dev/stderr
fi

This untested but something I wil probably work on given a little time I am
sure there are bugs there somewhere shell globbing might work but not sure and
the redirections might or might not be correct I can never remember


Hmm.  might be the start of something.

Bret



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to