From 8b9fa689319ca86275ae54f59894fb3c45ffbde6 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 27 Dec 2019 23:00:32 +1000 Subject: Update script now tucks the archives into daily folders. --- apt-panopticon-update-data.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua index ceef7f3..82509ad 100755 --- a/apt-panopticon-update-data.lua +++ b/apt-panopticon-update-data.lua @@ -46,7 +46,7 @@ os.execute('touch ' .. lock) if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end -local files = io.popen('ls -1 results_*.tar.xz') +local files = io.popen('ls -1 results_*.tar.xz 2>/dev/null; ls -1 results_*/results_*.tar.xz 2>/dev/null') for l in files:lines() do local lsub = l:sub(1, -8) if 0 == oldest then @@ -58,6 +58,8 @@ for l in files:lines() do end if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end os.execute('tar -xf ' .. l) + +--[[ os.execute('rm -f ' .. lsub .. '/*.curl') os.execute('rm -f ' .. lsub .. '/STATUS_*') @@ -95,9 +97,11 @@ for l in files:lines() do for k in fls:lines() do fixResults(k) end +]] end +--[[ if -1 < APT.verbosity then print('\nDeleting old RRD data.') end os.execute('rm -fr rrd') if -1 < APT.verbosity then print('\nRecreating RRD data.') end @@ -127,16 +131,22 @@ for l in files:lines() do end end end - +]] os.execute('rm ' .. lock) if -1 < APT.verbosity then print('\nRecreating tarballs.') end -local files = io.popen('ls -1 results_*.tar.xz') + +local files = io.popen('ls -1 results_*/results_*.tar.xz 2>/dev/null') +for l in files:lines() do + if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -c --xz ' .. l:sub(20, 43) .. ' -f ' .. l); io.stdout:flush() end + os.execute('mkdir -p ' .. l:sub(1, 18) .. '; tar -c --xz ' .. l:sub(20, 43) .. ' -f ' .. l .. '; rm -fr ' .. l:sub(20, 43)) +end +local files = io.popen('ls -1 results_*.tar.xz 2>/dev/null') for l in files:lines() do - if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -c --xz ' .. l:sub(1, 24) .. ' -f ' .. l .. '; rm -fr ' .. l:sub(1, 24)); io.stdout:flush() end - os.execute('tar -c --xz ' .. l:sub(1, 24) .. ' -f ' .. l .. '; rm -fr ' .. l:sub(1, 24)) + if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -c --xz ' .. l:sub(1, 24) .. ' -f ' .. l:sub(1, 18) .. '/' .. l); io.stdout:flush() end + os.execute('mkdir -p ' .. l:sub(1, 18) .. '; tar -c --xz ' .. l:sub(1, 24) .. ' -f ' .. l:sub(1, 18) .. '/' .. l .. '; rm -fr ' .. l:sub(1, 24) .. '; rm -f ' .. l) end -- cgit v1.1