--- dspam_logrotate 2006-01-10 09:01:43.000000000 -0600 +++ dspam_logrotate 2006-12-08 11:10:52.000000000 -0600 @@ -36,6 +36,10 @@ my($printStats); ($filename, $cutoffTimestamp, $printStats) = @_; + #preserve timestamps and ownership of the files + my ( $mode, $uid, $gid ) = ( stat($filename) )[ 2, 4, 5 ]; + $mode = $mode & 07777; + # Generate names for the temporary files. my($tempInputFile) = $filename . ".in"; my($tempOutputFile) = $filename . ".out"; @@ -79,6 +83,12 @@ # Rename our temporary output file to the original log file name. close OUTFILE; + + #apply previous permissions and ownerships to temp file before renaming + + chmod $mode, $tempOutputFile; + chown $uid, $gid, $tempOutputFile; + rename $tempOutputFile, $filename; # Remove our temporary input file.