Queue problem
Denis Beauchemin
Denis.Beauchemin at USherbrooke.ca
Sun Mar 2 12:14:00 GMT 2008
Julian Field a écrit :
> MailScanner --debug --debug-sa 2>&1 | awk '{printf"%s %s\n",
> strftime("%T"), $0}' | tee /tmp/mstest.log
> all on 1 long line.
>
> I have just built this functionality into MailScanner itself, so that
> in future "MailScanner --debug --debug-sa" will do this automatically
> for you.
>
> But don't worry, it starts by doing a test run of the command to see
> if it works, that "awk" is found and the version of awk installed
> supports the "strftime" function (not all do). It then only does the
> output change if the trial command produced the output I was expecting
> and not any errors that would be caused by awk not being found or
> strftime not doing what I expected. If the test fails, it prints out a
> little message telling you that it tried, and what you might do to
> improve your system so that it does work.
>
>
Julian,
If you don't want to rely on awk, the following code may be more portable:
MailScanner --debug --debug-sa 2>&1 | while true; do read line; echo
"$(date +%T) $line"; done
You could also replace $(...) with `...`
Denis
More information about the MailScanner
mailing list