![]() |
| ||
| capturing line from script output and appending to a file Hi Folks! This should be trivial, but because of this guy Murphy, it's turned out to be anything but. OK, here goes: Requirement: On a mail gateway running postfix, 1. dump any mail from MAILER-DAEMON via the "postsuper" command. 2. Record how many messages get dumped into a flat file (called, rather unimaginatively, "cron_purge") with a timestamp. ------ 3. (Beyond the scope of this) later on, graph the results of purges by hour/day/week/month/year. Method: 1. Do the PURGE mailq | grep -v "^[^0-9A-Z]+" | grep MAILER-DAEMON | awk '{print $1}' | postsuper -d -but what to do with the output? it looks like this:Quote:
the LAST line is always this: Quote:
# purge the queue (and suppress screen output) The number is not ending up in the cron_purges file. The timestamp is OK, but at the right side of the "-" there is no number. As I remarked at the beginning, this ought to be minor in nature, but I'll be darned if I can get the thing to function. As always, a fresh pair of eyes looking at this will see things with greater clarity than the fog that seems to be between me and my terminal right now. Ideas would be most gratefully received! :confused: May the Magnificent Arc and its Gaseous Shield be with you all. Do not weld anything while standing in ankle deep water. Use eye protection at all times, and avoid flying slag like the plague. Warm Regards, Bob The Welder |
| All times are GMT -4. The time now is 11:02 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC