"Voytek" <[EMAIL PROTECTED]> writes:
> after I logresolve the original log, I'd like to delete the unresolved
> input log file(s)
> how do I asses error level of logresolve's succesfull completion before I
> rm the input log ?
This doesn't answer your question, but I would look in to how the log
files are rotated, there might be hooks to run logresolve, or a script
from there.
If not, another approach, which coincidently contains the answer to your
question
# get a list of logs directories, might not be the safest way to do it
# if there are a lot of directories in home, it might fail.
for DIR in `ls -d /home/*/logs`; do
# find *-access.log files that were last modified over a day ago
# we don't want to touch the current log file.
find $DIR -name '*-access.log' -mtime +1 | while read FILE; do
T=`basename ${FILE} .log`
ROG="${T}.rog"
# run logresolve and test if it was successful.
# The answer to your question
if logresolve < ${FILE} > ${ROG} ;then
rm ${FILE}
else
echo $0: error logresolving ${FILE}
fi
done
This is completely untested, it also relys on logresolve returning
true on success and false on failure. It will be a few days behind in
logresolving files, but you could fix that if you wanted to.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html