[NTLUG:Discuss] Writing to /var/log/messages ?
David Simmons, PE
dsimmons at powersmiths.com
Fri Jan 14 14:29:33 CST 2005
To bring some finality to this thread, I'd like to 'splain the reason
and solution:
Initial problem: OpenBSD SAMBA file-server for Windows/Mac environment
- recent changes in how Word/Excel 'clean-up' and/or access the SAMBA
server have been leaving the temp files (listed here for keyword
searches for solution of same problem: ~*.tmp, ~*.doc, ~*.xls, A*.doc &
A*.xls - with zero filesizes, ~$*) from these programs behind - they're
starting to pile-up - gotta do something. And I wanted the final result
to show up in the /var/log/messages file so that I can keep tabs on how
well it's doing?!.
Initial solution/thought: Create a CRON job that searches through area
and nightly cleans them up. The find command is your friend. The
logger command is your friend for writing to /var/log/messages. Server
is running an older version of the OS, and find was experiencing some
memory leak/allocation errors - uh,oh, now what?
Final Solution/script:
It was suggested to use the command 'find2perl' that converts the find
command & arguments into perl code (very cool BTW)! The following
script was repeated in a shell file replacing the variable $SEARCH with
the above listed search strings:
find2perl /shared -name "$SEARCH" -print -exec rm "{}" \; | perl
2>/dev/null | wc -l | xargs logger -p daemon.notice Number of $SEARCH
files found:
Hope this helps someone, it has sure helped me - thanks to those whom
have helped!
dave
More information about the Discuss
mailing list