#! /bin/sh

#    SAM-QFS_notice_begin
#
#      Solaris 2.x Sun Storage & Archiving Management File System
#
#      Copyright (c) 2004 Sun Microsystems, Inc.
#      All Rights Reserved.
#
#      Government Rights Notice
#      Use, duplication, or disclosure by the U.S. Government is
#      subject to restrictions set forth in the Sun Microsystems,
#      Inc. license agreements and as provided in DFARS 227.7202-1(a)
#      and 227.7202-3(a) (1995), DRAS 252.227-7013(c)(ii) (OCT 1988),
#      FAR 12.212(a)(1995), FAR 52.227-19, or FAR 52.227-14 (ALT III),
#      as applicable.  Sun Microsystems, Inc.
#
#    SAM-QFS_notice_end

#
#  trace_rotate tracefile
#
#  trace_rotate is intended to be executed by sam-fsd when a tracefile
#  has aged or grown to the limits specified by the trace controls.
#  trace_rotate moves the current tracefile to tracefile.0 and rotates
#  former tracefiles accordingly.  If tracefile.7 exists it is lost.
#
#    ex:  trace_rotate /var/opt/SUNWsamfs/trace/sam-archiverd
#
#  If desired, you can disable the sam-fsd action, and perform the rotations
#  by using cron.  In a crontab you could do the following:
#
# 10 3 * * 0  /opt/SUNWsamfs/sbin/trace_rotate /var/opt/SUNWsamfs/trace/sam-archiverd
#
# $Id: trace_rotate,v 1.2 2004/03/02 20:28:16 cp129962 Exp $
#
TRACE=$1
#
if test -s $TRACE
then
   	test -f $TRACE.6 && mv $TRACE.6 $TRACE.7
   	test -f $TRACE.5 && mv $TRACE.5 $TRACE.6
   	test -f $TRACE.4 && mv $TRACE.4 $TRACE.5
   	test -f $TRACE.3 && mv $TRACE.3 $TRACE.4
   	test -f $TRACE.2 && mv $TRACE.2 $TRACE.3
   	test -f $TRACE.1 && mv $TRACE.1 $TRACE.2
   	test -f $TRACE.0 && mv $TRACE.0 $TRACE.1
   	mv $TRACE $TRACE.0
fi
