From 18dd54b8f0ba73abd84397977712926d3491f088 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 25 Dec 2019 23:10:15 +1000 Subject: Use proper time and date format, and check for the directory before tarballing it up. --- apt-panopticon.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apt-panopticon.lua') diff --git a/apt-panopticon.lua b/apt-panopticon.lua index b2827b4..ba5c064 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -1009,9 +1009,9 @@ 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 nil ~= adt then os.execute('ionice -c3 nice -n 19 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 2>/dev/null', 'r') + if (nil ~= adt) and APT.checkFile(adt) then os.execute('ionice -c3 nice -n 19 tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz &') end + local dt = os.date('!%F-%H-%M') + local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') local odt = fodt:read('*l') fodt:close() if nil ~= odt then os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') end @@ -1086,7 +1086,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. f = f:sub(9, -1) APT.logFile:write('
\n
\n

' .. f .. '

\n') for l in io.lines('results/' .. f) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() @@ -1102,7 +1102,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. g = g:sub(9, -1) APT.logFile:write('
\n
\n

' .. g .. '

\n') for l in io.lines('results/' .. g) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() @@ -1116,7 +1116,7 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. f = f:sub(9, -1) APT.logFile:write('
\n
\n

' .. f .. '

\n') for l in io.lines('results/' .. f) do - if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end + if l:match('^' .. os.date('%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(l .. '\n') end end end APT.logPost() -- cgit v1.1