I realize this thread is a bit old.
Here is what I use. It will empty all files in /var/log and its subdirectories while preserving permission and ownership. You will probably need to restart syslog/rsyslog afterwards. Works for me.
#!/bin/sh
loglist=`find /var/log -type f`
for i in $loglist
do
> $i
done
Last edited by MustardMan; 01-26-2012 at 10:25 AM.
|