ROTATE_LOG
Section: Maintenance Commands (8)
Updated: 89/12/11
Index
Return to Main Contents
NAME
rotate_log - rotate logfiles, removing the oldest
SYNOPSIS
rotate_log log [ -L log_dir ] [ -n n ] [ -c ] [ -B backup_dir ] [ -b backup_name ] [ -m mode ] [ -o owner ] [ -g group ] [ -M mode ] [ -O owner ] [ -G group ] [ -e "prolog_command" ] [ -E "postlog_command" ] logfile
DESCRIPTION
Rotate_log
takes a lot of the drudgery out of managing logfiles.
It assume you have a log file
logfile
and a series of backup copies
logfile.0,
logfile.1,
etc,
where
0
is the newest backup and
N
is the oldest.
Rotate_log
will remove the oldest,
rename the rest,
and empty out the original
logfile.
It has lots of options to let you control things:
- -L log_dir
-
Assume the
logfile
is in a directory named
log_dir.
- -n n
-
Use
n
backups.
If you don't set this, it defaults to three.
- -c
-
Compress(1)
the backup copies.
- -B backup_dir
-
Put the backed up log copies in the directory
backup_dir.
- -b backup_name
-
Name the backed up log copies
backup_name.
Note you can use both the
-B
and
-b
switches at the same time.
- -m mode
-
Set the mode (permissions) on
logfile
to
mode.
- -o owner
-
Set the ownership of
logfile
to
owner
(this option is only available to
root ).
- -g group
-
Set the group membership of
logfile
to
group
(this option is only available to
root ).
- -M mode
-
Set the mode (permissions) on
logfile.0
to
mode.
- -O owner
-
Set the ownership of
logfile.0
to
owner
(this option is only available to
root ).
- -O group
-
Set the group membership of
logfile.0
to
group
(this option is only available to
root ).
- -e prolog_command
-
prolog_command
is a command to be executed just before moving
logfile
to
logfile.0.
Note that if
prolog_command
has spaces, blanks, or metacharacters they must be quoted.
- -E postlog_command
-
prolog_command
is a command to be executed immediately after emptying
logfile
Note it is only executed if
logfile
is successfully emptied.
Note also that if
prolog_command
has spaces, blanks, or metacharacters they must be quoted.
Note that the mode and ownership settings apply only the the newly
created backups.
It is assumed that all older backups are already set as desired.
ERROR MESSAGES
Hopefully self-explaining.
This command bends over backwards checking for permission before
trying things,
and tries very hard to be informative when something isn't right.
FILES
None.
AUTHOR
Steve Simmons
COPYRIGHT STATUS
Copyright 1989 Steve Simmons
(scs@lokkur.dexter.mi.us).
Freely redistributable provided this copyright remains intact.
BUGS
Please report them to the author, scs@lokkur.dexter.mi.us.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- ERROR MESSAGES
-
- FILES
-
- AUTHOR
-
- COPYRIGHT STATUS
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 19:01:31 GMT, February 02, 2023