summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-08-03 11:24:55 +0200
committerErich Eckner <git@eckner.net>2017-08-03 11:24:55 +0200
commitdf67dfc9bd3fc91c5c0056ee3f5b7fd1678174f1 (patch)
tree4c89a783cf6372162c0642408b12d325de1a9aa5
parent48197b7b95b4a9a2160379921b904bb7b4617e26 (diff)
downloadbuilder-df67dfc9bd3fc91c5c0056ee3f5b7fd1678174f1.tar.xz
bin/build-master-status: truncate statistics to fixed time periode instead of fixed number of lines
-rwxr-xr-xbin/build-master-status9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/build-master-status b/bin/build-master-status
index 4ff3ed3..6601260 100755
--- a/bin/build-master-status
+++ b/bin/build-master-status
@@ -158,6 +158,7 @@ fi
if ${web}; then
sed -i 's|$|<br>|' "${tmp_dir}/build-master-status.html"
+ end=$(($(date +%s)-7*24*60*60))
(
[ -f "${webserver_directory}/statistics" ] && \
cat "${webserver_directory}/statistics"
@@ -174,8 +175,14 @@ if ${web}; then
"${locked}" \
"${blocked}" | \
sed 's| $|\n|'
+ echo "${end}"
) | \
- tail -n 10080 > \
+ sort -k1nr,1 | \
+ sed -n "
+ /^${end}\$/q
+ p
+ " | \
+ tac > \
"${tmp_dir}/statistics"
printf '<html>\n<body>\n<a href="build-logs/">build logs</a><br>\n<table>\n<tr>' >> \