Skip Headers
Oracle Hierarchical Storage Manager and QFS Software Command Reference
Section 1m: Maintenance Commands
Release 6.1.1
E70305-03

NAME

log_rotate.sh - Rotates log files

SYNOPSIS

∕opt∕SUNWsamfs∕examples∕log_rotate.sh fileminsize ]

AVAILABILITY

SUNWsamfs

DESCRIPTION

The log_rotate.sh script rotates log files generated by Oracle Hierarchical Storage Manager (Oracle HSM) environments and other programs.

The process of rotating log files assumes that you want to keep no more than seven generations of a file in your directories at one time. If the size of file is minsize or greater, the files are rotated. When the files are rotated, the newest file is renamed file.1, the next-newest file is renamed file.2, and so on. The oldest file in the directory is deleted as new ones are added, so the oldest file in the directory at any time is always called file.7. This process provides the following benefits:

You should send a HUP signal to syslogd after rotating the Oracle HSM log file to make syslogd close and reopen the file in its new location. This is not necessary for files created by Oracle HSM processes because they check to see if the file has been changed whenever it is opened.

The following are some of the Oracle HSM files you should consider rotating:

Oracle HSM log file

See ∕etc∕syslog.conf for location.

∕devlog files

∕var∕opt∕SUNWsamfs∕devlog∕.

Stage log files

See ∕etc∕opt∕SUNWsamfs∕stager.cmd for location.

Releaser log files

See ∕etc∕opt∕SUNWsamfs∕releaser.cmd for location.

Recycler log files

See ∕etc∕opt∕SUNWsamfs∕recycler.cmd for location.

SEF data files

∕var∕opt∕SUNWsamfs∕sef∕sefdata.

Note that the information in the archiver log is valuable and should be preserved. It should not be discarded after a short period of time.

OPTIONS

This script accepts the following arguments:

file

The log file to be rotated. For example, sam-log.

minsize

Specify an integer number, in bytes, that represents the minimum size of the log file to be rotated. Log files smaller than this minimum are not rotated. The default minsize is 100000.

To enable this script, copy it from ∕opt∕SUNWsamfs∕examples∕log_rotate.sh to ∕opt∕SUNWsamfs∕scripts∕log_rotate.sh, modify it to take the desired action for your installation, and set up a crontab (1) entry to run the log_rotate.sh script.

EXAMPLES

The examples that follow assume that you have copied the script from its location in ∕opt∕SUNWsamfs∕examples∕log_rotate.sh to ∕opt∕SUNWsamfs∕scripts∕log_rotate.sh.

Example 1. Assume that you want to set up a crontab (1) entry to run the log_rotate.sh script at a desired interval for each of the log files you wish to rotate. To rotate file sam-log every week, the entry would appear as follows:

10 3 * * 0  ∕etc∕opt∕SUNWsamfs∕scripts∕log_rotate.sh ∕var∕adm∕sam-log
20 3 * * 0  ∕bin∕kill -HUP `∕bin∕cat ∕etc∕syslog.pid`

This crontab (1) file rotates the ∕var∕adm∕sam-log files every day at 0310. The second line sends a HUP signal to the syslogd daemon to notify it to close the file (which has been moved) and open a new one. Note that this action is only useful for files written by syslogd.

Example 2. To rotate file releaser-log every week, the entry would appear as follows:

40 2 * * 0  ∕etc∕opt∕SUNWsamfs∕scripts∕log_rotate.sh ∕var∕adm∕releaser-log

This crontab (1) file rotates the ∕var∕adm∕releaser-log files every day at 0240.

FILES

The log_rotate.sh script resides in the following location:

∕opt∕SUNWsamfs∕examples∕log_rotate.sh

SEE ALSO

crontab(1), syslogd(1M).