D-I TODO item (syslog stuff)
While reading debian-installer/installer/doc/TODO I spotted the
following:
* There needs to be a centralised logging method. Syslog will do, but
we currently have a lot of nasty code that appends messages to
/var/log/messages directly. All of that would be converted to pipe
it to logger. However, this is a problem, because piping a command
to logger loses the exit status of the command. Need some way to
run a command, logging the ouput to syslog, w/o losing exit status.
Is this in fact still outstanding?
Some time ago (for a very different piece of code -- our backup code
in fact), I wrote a small set of functions which runs a command with
the stdout (and/or stderr) being piped over where each line can be
logged (to a file in my case) and then exits with the status of the
child process (which is the advantage over using logger).
I extracted the relevant code and made it standalone though it might
need a bit of tidying up before I'd want to submit it.
I thought I'd check if this might be useful before doing any work on
cleaning it up, after all someone else might have already sorted this
out years ago...
$ ./wrapit -eop "ERR: " -- ls -al /tmp/nonexist
ERR: ls: /tmp/nonexist: No such file or directory
$ echo $?
1
is this the sort of thing you want (except with the result syslog'd)?
-- Jon
Jon Peatfield, Computer Officer, DAMTP, University of Cambridge
Mail: jp107@damtp.cam.ac.uk Web: http://www.damtp.cam.ac.uk/
Reply to: