Solstice Backup 5.1 Administration Guide

How to Use the Operating System Services to Trim Log Files

You can use the Solaris operating environment services to automatically manage the size of the Backup log files.

Solaris software provides a two-part mechanism for managing the syslog message file (/var/log/syslog): a shell script (/usr/lib/newsyslog) and a crontab entry for root to periodically invoke the script.

You can modify the newsyslog script to manage and maintain a short history of the Backup server's log file. The modified script maintains a three-file history of the Backup server`s daemon.log file.

To manage your Backup log file, follow these steps:

  1. Use your favorite text editor to add the following lines to /usr/lib/newsyslog:


    LOGDIR=/nsr/logs
    LOG=daemon.log
    if test -d $LOGDIR
    then
        cd $LOGDIR
        test -f $LOG.1 && mv $LOG.1 $LOG.2
        test -f $LOG.0 && mv $LOG.0 $LOG.1
        test -f $LOG   && mv $LOG   $LOG.0
        cp /dev/null $LOG
        chmod 644 $LOG
    fi
    

    Backup cannot use the new log file until you shut down and restart the Backup daemons. Shut down the daemons with the nsr_shutdown command, either manually or as an additional command in the newsyslog script. Make sure that the script does not run during a scheduled save. Then, restart Backup manually using the following commands:


    # /etc/init.d/networker start
    
  2. Add an entry to crontab for root to control the frequency of running the newsyslog script.

    The entry shown in the following example invokes the newsyslog script every Saturday morning at 4:05 a.m.:


    5 4 * * 6   /usr/lib/newsyslog

    If your Solaris system does not have the newsyslog script and crontab entry to invoke it, create the newsyslog script manually and add the crontab entry for it. See the crontab(1) man page for more information.