From 78fef0f95d89d6e349ae3328555e2b0b043db756 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 5 Dec 2019 03:10:45 +1000 Subject: Pack up ancient results for later. --- apt-panopticon.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 430aa87..3afe3a1 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -1098,9 +1098,13 @@ if 0 < #arg then logPost() logFile:close() else + local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") + local adt = fadt:read('*l') + fadt:close() + if 0 ~= #adt then os.execute('tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz') end local dt = os.date('!%Y-%m-%d-%H-%M') local fodt = io.popen('TZ="GMT" date -r results/stamp +%Y-%m-%d-%H-%M', 'r') - odt = fodt:read('*l') + local odt = fodt:read('*l') fodt:close() os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') @@ -1156,6 +1160,8 @@ else end end + if 0 ~= #adt then os.execute('rm -fr ' .. adt .. ' 2>/dev/null') end + logPost() logFile:close() end -- cgit v1.1