Novell Home

Retaining Numerous Copies of SEGSTATS.TXT

Novell Cool Solutions: Tip
By Bill Callan

Digg This - Slashdot This

Posted: 16 Mar 2006
 

Problem:

TID #10097396 - "How to read SEGSTATS.TXT" mentions using cron and toolbox to automate the backup of SEGSTATS.TXT, generated by SEG.NLM. The author states that this only retains one backup copy and you have to be sure CRON doesn't load on start or you may overwrite the files.

Solution:

Use CRON to launch the following SAVESEG.NCF to retain numerous copies of SEGSTATS.TXT.

CRONTAB

0,15,30,45 * * * * SAVESEG.NCF

SAVESEG.NCF

seg writestats
%if !loaded toolbox then cmd toolbox /nl
%if loaded toolbox then cmd cp sys:system\segstats.txt sys:system\segstat\[env %hour]-[env %minute].txt

This will create SEGSTAT.TXT at 15 minute intervals and backup them up to SYSTEM\SEGSTAT\(CurrentTime).txt. Backups will be overwritten starting at midnight the next day, keeping 24 hours worth of statistics available and eliminating the need to manually load CRON after startup.

If you need more history, use other combinations of builtin environment variables (type %env at the system console to see what's available). For example, the following will keep backups for a week before starting to overwrite (the weekday variable is 0=Sunday, 1=Monday, etc)

%if loaded toolbox then cmd cp sys:system\segstats.txt sys:system\segstat\[env %weekday]_[env %hour]-[env %minute].txt

Environment:

Only works for NetWare 6.x with conditional scripting commands (%if, %env, etc).


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell