Networker

Re: [Networker] what utility to truncate legato messages

2004-01-30 14:29:48
Subject: Re: [Networker] what utility to truncate legato messages
From: Davina Treiber <Treiber AT HOTPOP DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Fri, 30 Jan 2004 16:20:17 +0000
Wang Chen wrote:
Stan,

Networker 7.0 in Solaris.
I would like truncate the nsr/logs/messages, keep last
30 days log, and get rid of the old logs. TIA.


--- Stan Horwitz <stan AT TEMPLE DOT EDU> wrote:

On Mon, 26 Jan 2004, Wang Chen wrote:


Does Legato come up with an utility to truncate log
file?

There is nothing supplied for this, but rotating the logs is a simple
script. NetWorker does rotate them but only on a restart. It keeps 4
versions by default, this can be changed by setting the NSR_MAXVERS
variable in your NetWorker start script.

Here is what I use to rotate logs on Solaris:





#!/bin/ksh

umask 022
LOGDIR=/nsr/logs
typeset -Z3 MAXVERS MAXVERSPLUS1
# value below needs to be the same as the value of MAXVERS set in
/etc/init.d/networker
MAXVERS=12
let MAXVERS-=1
cd $LOGDIR
while [ $MAXVERS -gt 0 ]; do
        let MAXVERSPLUS1=$MAXVERS+1
        [ -f messages.$MAXVERS ] && mv \
messages.$MAXVERSmessages.$MAXVERSPLUS1
        [ -f daemon.$MAXVERS ] && mv daemon.$MAXVERS \
daemon.$MAXVERSPLUS1
        chmod 644 daemon.*
        let MAXVERS-=1
done
mv messages messages.001
> messages
kill -1 $(cat /etc/syslog.pid)
cp -p daemon.log daemon.001
> daemon.log

--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=