Skip to content

Commit

Permalink
Backport debian manpage and mktime patches
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaluza committed Oct 15, 2014
1 parent 805b875 commit 9c68d75
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
41 changes: 23 additions & 18 deletions logrotate.8
Expand Up @@ -11,8 +11,8 @@ removal, and mailing of log files. Each log file may be handled daily,
weekly, monthly, or when it grows too large.
.P
Normally, \fBlogrotate\fR is run as a daily cron job. It will not modify
a log multiple times in one day unless the criterion for that log is
based on the log's size and \fBlogrotate\fR is being run multiple times
a log more than once in one day unless the criterion for that log is
based on the log's size and \fBlogrotate\fR is being run more than once
each day, or unless the \fB\-f\fR or \fB\-\-force\fR option is used.
.P
Any number of config files may be given on the command line. Later config
Expand Down Expand Up @@ -67,7 +67,7 @@ Prints a short usage message.

.TP
+\fB\-v\fR, \fB\-\-verbose\fR
Turns on verbose mode.
Turns on verbose mode, ie. display messages during rotation.

.SH CONFIGURATION FILE

Expand Down Expand Up @@ -119,24 +119,25 @@ compress
The first few lines set global options; in the example, logs are
compressed after they are rotated. Note that comments may appear
anywhere in the config file as long as the first non-whitespace
character on the line is a #.
character on the line is a \fB#\fR.

The next section of the config files defined how to handle the log file
The next section of the config file defines how to handle the log file
\fI/var/log/messages\fR. The log will go through five weekly rotations before
being removed. After the log file has been rotated (but before the old
version of the log has been compressed), the command
\fI/sbin/killall \-HUP syslogd\fR will be executed.

The next section defines the parameters for both
\fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR.
They are rotated whenever it grows over 100k in size, and the old logs
Each is rotated whenever it grows over 100k in size, and the old logs
files are mailed (uncompressed) to www@my.org after going through 5
rotations, rather than being removed. The \fBsharedscripts\fR means that
the \fBpostrotate\fR script will only be run once (after the old logs have
been compressed), not once for each log which is rotated. Note that the double
quotes around the first filename at the beginning of this section allows
logrotate to rotate logs with spaces in the name. Normal shell quoting rules
apply, with ', ", and \\ characters supported.
been compressed), not once for each log which is rotated.
Note that log file names may be enclosed in
quotes (and that quotes are required if the name contains spaces).
Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR
characters supported.

The next section defines the parameters for all of the files in
\fI/var/log/news\fR. Each file is rotated on a monthly basis. This is
Expand All @@ -162,12 +163,12 @@ Old versions of log files are compressed with \fBgzip\fR(1) by default. See also
.TP
\fBcompresscmd\fR
Specifies which command to use to compress log files. The default is
\fBgzip\fR. See also \fBcompress\fR.
\fBgzip\fR(1). See also \fBcompress\fR.

.TP
\fBuncompresscmd\fR
Specifies which command to use to uncompress log files. The default is
\fBgunzip\fR.
\fBgunzip\fR(1).

.TP
\fBcompressext\fR
Expand All @@ -194,7 +195,7 @@ as the old log file stays in place.

.TP
\fBcopytruncate\fR
Truncate the original log file in place after creating a copy,
Truncate the original log file to zero size in place after creating a copy,
instead of moving the old log file and optionally creating a new one.
It can be used when some program cannot be told to close its logfile
and thus might continue writing (appending) to the previous log file forever.
Expand Down Expand Up @@ -254,7 +255,7 @@ and thus might continue writing to the previous log file for some time.
.TP
\fBextension \fIext\fR
Log files with \fIext\fR extension can keep it after the rotation.
If compression is used, the compression extension (normally \fB.gz\fR)
If compression is used, the compression extension (normally \fI.gz\fR)
appears after \fIext\fR. For example you have a logfile named mylog.foo
and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz.

Expand All @@ -281,7 +282,7 @@ the taboo extensions, as specified by the \fBtabooext\fR directive.

.TP
\fBmail \fIaddress\fR
When a log is rotated out-of-existence, it is mailed to \fIaddress\fR. If
When a log is rotated out of existence, it is mailed to \fIaddress\fR. If
no mail should be generated by a particular log, the \fBnomail\fR directive
may be used.

Expand Down Expand Up @@ -361,15 +362,15 @@ Do not archive old versions of log files with date extension

.TP
\fBnomail\fR
Don't mail old log files to any address.
Do not mail old log files to any address.

.TP
\fBnomissingok\fR
If a log file does not exist, issue an error. This is the default.

.TP
\fBnoolddir\fR
Logs are rotated in the same directory the log normally resides in (this
Logs are rotated in the directory they normally reside in (this
overrides the \fBolddir\fR option).

.TP
Expand Down Expand Up @@ -498,7 +499,10 @@ number of times specified with the \fBrotate\fR directive.
\fBsu \fIuser\fR \fIgroup\fR
Rotate log files set under this user and group instead of using default
user/group (usually root). \fIuser\fR specifies the user name used for
rotation and \fIgroup\fR specifies the group used for rotation.
rotation and \fIgroup\fR specifies the group used for rotation. If the
user/group you specify here does not have sufficient privilege to make
files with the ownership you've specified in a \fIcreate\fR instruction,
it will cause an error.

.TP
\fBtabooext\fR [+] \fIlist\fR
Expand Down Expand Up @@ -539,5 +543,6 @@ Configuration options.
Erik Troan, Preston Brown, Jan Kaluza.

<logrotate-owner@fedoraproject.org>
<http://fedorahosted.org/logrotate/>

.fi
2 changes: 2 additions & 0 deletions logrotate.c
Expand Up @@ -2198,12 +2198,14 @@ static int readState(char *stateFilename)
return 1;
}

memset(&st->lastRotated, 0, sizeof(st->lastRotated));
st->lastRotated.tm_year = year;
st->lastRotated.tm_mon = month;
st->lastRotated.tm_mday = day;
st->lastRotated.tm_hour = hour;
st->lastRotated.tm_min = minute;
st->lastRotated.tm_sec = second;
st->lastRotated.tm_isdst = -1;

/* fill in the rest of the st->lastRotated fields */
lr_time = mktime(&st->lastRotated);
Expand Down

0 comments on commit 9c68d75

Please sign in to comment.