diff options
author | onefang | 2019-12-28 00:24:18 +1000 |
---|---|---|
committer | onefang | 2019-12-28 00:24:18 +1000 |
commit | e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9 (patch) | |
tree | 5c325fc97387c12b3ce0d8c29d6e631d9df87253 | |
parent | Archive results to a daily folder. (diff) | |
download | apt-panopticon-e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9.zip apt-panopticon-e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9.tar.gz apt-panopticon-e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9.tar.bz2 apt-panopticon-e0e811c83bf61f896064e9d5d70d2a46c9f4b5f9.tar.xz |
A better way to clean up after the archiving, no need to wait for it.
-rwxr-xr-x | apt-panopticon.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 72627a0..e54e553 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -1064,7 +1064,10 @@ else | |||
1064 | local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") | 1064 | local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") |
1065 | local adt = fadt:read('*l') | 1065 | local adt = fadt:read('*l') |
1066 | fadt:close() | 1066 | fadt:close() |
1067 | if (nil ~= adt) and APT.checkFile(adt) then os.execute('mkdir -p ' .. adt:sub(1, 18) .. '; ionice -c3 nice -n 19 tar -c --xz ' .. adt .. ' -f ' .. adt:sub(1, 18) .. '/' .. adt .. '.tar.xz &') end | 1067 | if (nil ~= adt) and APT.checkFile(adt) then |
1068 | os.execute('{ mkdir -p ' .. adt:sub(1, 18) .. ' && ionice -c3 nice -n 19' .. | ||
1069 | ' tar -c --xz ' .. adt .. ' -f ' .. adt:sub(1, 18) .. '/' .. adt .. '.tar.xz && rm -fr ' .. adt .. ' 2>/dev/null; } &') | ||
1070 | end | ||
1068 | local dt = os.date('!%F-%H-%M') | 1071 | local dt = os.date('!%F-%H-%M') |
1069 | local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') | 1072 | local fodt = io.popen('TZ="GMT" date -r results/stamp +%F-%H-%M 2>/dev/null', 'r') |
1070 | local odt = fodt:read('*l') | 1073 | local odt = fodt:read('*l') |
@@ -1212,10 +1215,6 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
1212 | end | 1215 | end |
1213 | end | 1216 | end |
1214 | 1217 | ||
1215 | os.execute('sleep 1') -- Wait for things to start up before checking for them. | ||
1216 | while 1 <= APT.checkExes('tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz') do os.execute("sleep 10") end | ||
1217 | if nil ~= adt then os.execute('rm -fr ' .. adt .. ' 2>/dev/null') end | ||
1218 | |||
1219 | I('Total run time was ' .. (os.time() - now) .. ' seconds.') | 1218 | I('Total run time was ' .. (os.time() - now) .. ' seconds.') |
1220 | APT.logPost() | 1219 | APT.logPost() |
1221 | end | 1220 | end |