Dear all,
My question was:
> On my DU box, the file /usr/var/nsr/logs/summary is becoming huge
> (thanks to Popper, mainly).
> Is there any problem in renaming this file and touching a new one?
The respondents all agreed on something like that:
1) stop nsr (/sbin/init.d/nsr stop) if necessary
2) make a copy of the log file (and after that, do what you want with it)
3) empty the log file (cp /dev/null the_log_file)
4) restart nsr (/sbin/init.d/nsr start) if necessary
Here are the answers I recieved (thanks colleagues!):
######## from: Mark.Witman_at_mpg.gmpt.gmeds.com
You should be able to rename /nsr/logs/
daemonlog
messages
summary
but, you may want to shutdown Networker before you move/touch the files.
I have renamed the files successfully this way.
######## from: "WHITTAKER, Bruce" <bjw_at_ansto.gov.au>
I don't know if it would cause problems or not - but I think that if I
were to try something like that I would try to copy the summary file
to another file, then cat /dev/null to the file to empty it. That way,
any daemons running will think that they have continuous access to the
file.
Some daemons can hang if a file they are working on suddenly disappears
- even if it does re-appear later on.
######## from: Hellebo Knut <Knut.Hellebo_at_nho.hydro.com>
The best thing to do is to create a perl/shell script that rotates the log,
keeping only a few versions available preventing it from occupying so much
space. A quick workaround is
tail -x summary > newlog
cp /dev/null summary
where x is a appropriate number
######## from: "William H. Magill" <magill_at_isc.upenn.edu>
The summary file is created (presumably) out of syslogd.
So just treat it like any other syslog file that you want to rotate...
====================<begin ksh fragment>=========================
if [ -d /nsr/logs ]; then
cd /nsr/logs
nsrlogfiles="messages media"
for file in $nsrlogfiles
do
rm -f $file.log.7
mv -f $file.log.6 $file.log.7
mv -f $file.log.5 $file.log.6
mv -f $file.log.4 $file.log.5
mv -f $file.log.3 $file.log.4
mv -f $file.log.2 $file.log.3
mv -f $file.log.1 $file.log.2
mv -f $file.log.0 $file.log.1
mv -f $file.log $file.log.0
cp /dev/null $file.log
$CHMOD 640 $file.log
$CHOWN root $file.log
$CHGRP backup $file.log
$CHMOD 640 $file.log*
$CHOWN root $file.log*
$CHGRP backup $file.log*
done
print "cycled /nsr/logs."
else
print "no /nsr/logs directory "
fi
====================<end ksh fragment>=========================
The daemon.log file however is more of a pain in the ass.
It is a hardcoded file name and controlled by the NSR daemon itself, and so
far, the only way I have found to get it to release the old file is to
shutdown and restart NSR...
mv daemon.log
/sbin/init.d/nsr stop
/sbin/init.d/nsr start
Received on Mon Jan 27 1997 - 16:18:17 NZDT