Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154825235
D52700.id162688.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D52700.id162688.diff
View Options
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -2610,7 +2610,7 @@
mtime = sb.st_mtime;
}
- return ((int)(ptimeget_secs(timenow) - mtime + 1800) / 3600);
+ return ((int)(ptimeget_secs(timenow) - mtime + 180) / 3600);
}
/* Skip Over Blanks */
diff --git a/usr.sbin/newsyslog/tests/legacy_test.sh b/usr.sbin/newsyslog/tests/legacy_test.sh
--- a/usr.sbin/newsyslog/tests/legacy_test.sh
+++ b/usr.sbin/newsyslog/tests/legacy_test.sh
@@ -417,6 +417,51 @@
tmpdir_clean
}
+tests_interval_rotate() {
+ local hours ext h
+
+ hours="$1"
+ ext="$2"
+
+ tmpdir_create
+
+ begin "create file" -newdir
+ run_newsyslog -C
+ ckfe ${LOGFNAME}
+ end
+
+ # old file doesn't exist - forced rotation
+ begin "rotate interval 0"
+ run_newsyslog
+ ckfe ${LOGFNAME}
+ chkfcnt 1 ${dir}${LOGFNAME}.*
+ end
+
+ # emulate newsyslog runs every 5 minutes
+ begin "rotate interval less than ${hours} hours"
+ m=0
+ while [ $(expr ${m} / 60 ) -lt ${hours} ]; do
+ touch -t $(date -v -${m}M +%Y%m%d%H%M) ${LOGFNAME}.0
+ run_newsyslog
+ ckfe ${LOGFNAME}
+ chkfcnt 1 ${dir}${LOGFNAME}.*
+ if [ $OK != 1 ]; then
+ break;
+ fi
+ m=$(expr ${m} + 5)
+ done
+ end
+
+ begin "rotate interval ${hours} hours"
+ touch -t $(date -v -${hours}H +%Y%m%d%H%M) ${LOGFNAME}.0
+ run_newsyslog
+ ckfe ${LOGFNAME}
+ chkfcnt 2 ${dir}${LOGFNAME}.*
+ end
+
+ tmpdir_clean
+}
+
tests_rfc5424() {
local dir ext name_postfix newsyslog_args
@@ -526,7 +571,7 @@
tmpdir_clean
}
-echo 1..185
+echo 1..193
mkdir -p ${TMPDIR}
cd ${TMPDIR}
@@ -638,4 +683,10 @@
echo "$LOGFPATH 640 3 * @T00 NCZ" > newsyslog.conf
tests_normal_rotate_recompress
+# Interval based rotation
+echo "$LOGFPATH 640 3 * 1 NC" > newsyslog.conf
+tests_interval_rotate 1
+echo "$LOGFPATH 640 3 * 2 NC" > newsyslog.conf
+tests_interval_rotate 2
+
rm -rf "${TMPDIR}"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 30, 1:12 PM (5 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32516019
Default Alt Text
D52700.id162688.diff (1 KB)
Attached To
Mode
D52700: newsyslog: fix one hour rotation with frequent execution
Attached
Detach File
Event Timeline
Log In to Comment