ea89d9100d
prerotate/postrotate script.
103 lines
5.5 KiB
Diff
103 lines
5.5 KiB
Diff
Index: logrotate.8
|
|
===================================================================
|
|
--- logrotate.8 (revision 277)
|
|
+++ logrotate.8 (working copy)
|
|
@@ -217,6 +217,11 @@
|
|
The default value is -%Y%m%d. Note that also the character separating log
|
|
name from the extension is part of the dateformat string. The system clock
|
|
must be set past Sep 9th 2001 for %s to work correctly.
|
|
+Note that the datestamps generated by this format must be lexically sortable
|
|
+(i.e., first the year, then the month then the day. e.g., 2001/12/01 is ok,
|
|
+but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later).
|
|
+This is because when using the \fBrotate\fR option, logrotate sorts all
|
|
+rotated filenames to find out which logfiles are older and should be removed.
|
|
|
|
.TP
|
|
\fBdelaycompress\fR
|
|
@@ -336,7 +341,8 @@
|
|
\fBnosharedscripts\fR
|
|
Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log file which
|
|
is rotated (this is the default, and overrides the \fBsharedscripts\fR
|
|
-option). If the scripts exit with error, the remaining actions will
|
|
+option). The absolute path to the log file is passed as first argument
|
|
+to the script. If the scripts exit with error, the remaining actions will
|
|
not be executed for the affected log only.
|
|
|
|
.TP
|
|
@@ -359,36 +365,44 @@
|
|
.TP
|
|
\fBpostrotate\fR/\fBendscript\fR
|
|
The lines between \fBpostrotate\fR and \fBendscript\fR (both of which
|
|
-must appear on lines by themselves) are executed after the log file is
|
|
-rotated. These directives may only appear inside a log file definition.
|
|
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR)
|
|
+after the log file is rotated. These directives may only appear inside
|
|
+a log file definition. Normally, the absolute path to the log file is
|
|
+passed as first argument to the script. If \fBsharedscripts\fR is specified,
|
|
+whole pattern is passed to the script.
|
|
See also \fBprerotate\fR. See \fBsharedscripts\fR and \fBnosharedscripts\fR
|
|
for error handling.
|
|
|
|
.TP
|
|
\fBprerotate\fR/\fBendscript\fR
|
|
The lines between \fBprerotate\fR and \fBendscript\fR (both of which
|
|
-must appear on lines by themselves) are executed before the log file is
|
|
-rotated and only if the log will actually be rotated. These directives
|
|
-may only appear inside a log file definition. See also \fBpostrotate\fR.
|
|
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) before
|
|
+the log file is rotated and only if the log will actually be rotated. These
|
|
+directives may only appear inside a log file definition. Normally,
|
|
+the absolute path to the log file is passed as first argument to the script.
|
|
+If \fBsharedscripts\fR is specified, whole pattern is passed to the script.
|
|
+See also \fBpostrotate\fR.
|
|
See \fBsharedscripts\fR and \fBnosharedscripts\fR for error handling.
|
|
|
|
.TP
|
|
\fBfirstaction\fR/\fBendscript\fR
|
|
The lines between \fBfirstaction\fR and \fBendscript\fR (both of which
|
|
-must appear on lines by themselves) are executed once before all log
|
|
-files that match the wildcarded pattern are rotated, before prerotate script
|
|
-is run and only if at least one log will actually be rotated. These directives
|
|
-may only appear inside a log file definition. If the script exits
|
|
-with error, no further processing is done. See also \fBlastaction\fR.
|
|
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once
|
|
+before all log files that match the wildcarded pattern are rotated, before
|
|
+prerotate script is run and only if at least one log will actually be rotated.
|
|
+These directives may only appear inside a log file definition. Whole pattern is
|
|
+passed to the script as first argument. If the script exits with error,
|
|
+no further processing is done. See also \fBlastaction\fR.
|
|
|
|
.TP
|
|
\fBlastaction\fR/\fBendscript\fR
|
|
The lines between \fBlastaction\fR and \fBendscript\fR (both of which
|
|
-must appear on lines by themselves) are executed once after all log
|
|
-files that match the wildcarded pattern are rotated, after postrotate script
|
|
-is run and only if at least one log is rotated. These directives may only
|
|
-appear inside a log file definition. If the script exits with
|
|
-error, just an error message is shown (as this is the last
|
|
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once
|
|
+after all log files that match the wildcarded pattern are rotated, after
|
|
+postrotate script is run and only if at least one log is rotated. These
|
|
+directives may only appear inside a log file definition. Whole pattern is
|
|
+passed to the script as first argument. If the script exits
|
|
+with error, just an error message is shown (as this is the last
|
|
action). See also \fBfirstaction\fR.
|
|
|
|
.TP
|
|
@@ -408,10 +422,12 @@
|
|
.TP
|
|
\fBsharedscripts\fR
|
|
Normally, \fBprerotate\fR and \fBpostrotate\fR scripts are run for each
|
|
-log which is rotated, meaning that a single script may be run multiple
|
|
+log which is rotated and the absolute path to the log file is passed as first
|
|
+argument to the script. That means a single script may be run multiple
|
|
times for log file entries which match multiple files (such as the
|
|
-\fI/var/log/news/*\fR example). If \fBsharedscript\fR is specified, the scripts
|
|
-are only run once, no matter how many logs match the wildcarded pattern.
|
|
+\fI/var/log/news/*\fR example). If \fBsharedscripts\fR is specified, the scripts
|
|
+are only run once, no matter how many logs match the wildcarded pattern,
|
|
+and whole pattern is passed to them.
|
|
However, if none of the logs in the pattern require rotating, the scripts
|
|
will not be run at all. If the scripts exit with error, the remaining
|
|
actions will not be executed for any logs. This option overrides the
|