aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmirror-checker.lua30
1 files changed, 18 insertions, 12 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua
index bba9d49..9f70bcd 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -36,7 +36,8 @@ options =
36} 36}
37 37
38local defaultURL = {scheme = "http"} 38local defaultURL = {scheme = "http"}
39local download = "wget -np -N -r -P results " 39local downloadLock = "flock -n results/wget-"
40local download = "wget --timeout=300 -np -N -r -P results " -- Note wget has a default read timeout of 900 seconds (15 minutes).
40local releases = {"jessie", "ascii", "beowulf", "ceres"} 41local releases = {"jessie", "ascii", "beowulf", "ceres"}
41local releaseFiles = 42local releaseFiles =
42{ 43{
@@ -269,21 +270,22 @@ local checkHost = function (host, path, ip)
269 checkIP(host, host, path, ip) 270 checkIP(host, host, path, ip)
270end 271end
271 272
272local downloads = function (host, URL, IP) 273local downloads = function (cut, host, URL)
274 if 0 ~= cut then cd = " --cut-dirs=" .. cut .. " " else cd = "" end
273 if nil == URL then URL = "/" end 275 if nil == URL then URL = "/" end
274 if nil == IP then IP = "" else IP = "-" .. IP end 276 local lock = "%s-" .. host .. ".log "
275 local log = " --rejected-log=results/wget-%s_REJECTS-" .. host .. IP .. ".log -a results/wget-%s-" .. host .. IP ..".log " 277 local log = " --rejected-log=results/wget-%s_REJECTS-" .. host .. ".log -a results/wget-%s-" .. host .. ".log "
276 I("starting file download commands for " .. host .. " " .. URL) 278 I("starting file download commands for " .. host .. " " .. URL)
277 local cm = "ionice -c3 " .. download .. log:format("debs", "debs") 279 local cm = "ionice -c3 " .. downloadLock .. lock:format("debs") .. download .. log:format("debs", "debs") .. cd
278 for i, s in pairs(referenceDebs) do 280 for i, s in pairs(referenceDebs) do
279 cm = cm .. " https://" .. host .. URL .. "/" .. s 281 cm = cm .. " https://" .. host .. URL .. "/" .. s
280 end 282 end
281 for i, s in pairs(releases) do 283 for i, s in pairs(releases) do
282 execute(cm .. " &") 284 execute(cm .. " &")
283 cm = "ionice -c3 " .. download .. log:format(s, s) 285 cm = "ionice -c3 " .. downloadLock .. lock:format(s) .. download .. log:format(s, s) .. cd
284 for j, k in pairs(releaseFiles) do
285 cm = cm .. " https://" .. host .. URL .. "/merged/dists/" .. s .. k
286 if repoExists(s .. k) then 286 if repoExists(s .. k) then
287 for j, k in pairs(releaseFiles) do
288 cm = cm .. " https://" .. host .. URL .. "/merged/dists/" .. s .. k
287 end 289 end
288 end 290 end
289 end 291 end
@@ -405,9 +407,13 @@ if 0 < #arg then
405 if nil ~= arg[2] then I(" Using IP " .. arg[2]) end 407 if nil ~= arg[2] then I(" Using IP " .. arg[2]) end
406 if testing("Integrity") or testing("Updated") then 408 if testing("Integrity") or testing("Updated") then
407 if not keep then execute("rm -fr results/" .. pu.host) end 409 if not keep then execute("rm -fr results/" .. pu.host) end
408 downloads(pu.host, pu.path, arg[2]) 410 cut = 0
411 for t in arg[1]:gmatch("(/)") do
412 cut = cut + 1
413 end
414 downloads(cut, pu.host, pu.path)
409 checkExes("mirror-checker.lua " .. sendArgs) 415 checkExes("mirror-checker.lua " .. sendArgs)
410 checkExes(download) 416 checkExes(downloadLock)
411 end 417 end
412 checkHost(pu.host, pu.path, arg[2]) 418 checkHost(pu.host, pu.path, arg[2])
413 logFile:close() 419 logFile:close()
@@ -432,11 +438,11 @@ else
432-- checkHost(pu.host) 438-- checkHost(pu.host)
433 forkIP(m.BaseURL) 439 forkIP(m.BaseURL)
434 checkExes("mirror-checker.lua " .. sendArgs) 440 checkExes("mirror-checker.lua " .. sendArgs)
435 if testing("Integrity") or testing("Updated") then checkExes(download) end 441 if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end
436 end 442 end
437 while 1 <= checkExes("mirror-checker.lua " .. sendArgs) do os.execute("sleep 30") end 443 while 1 <= checkExes("mirror-checker.lua " .. sendArgs) do os.execute("sleep 30") end
438 if testing("Integrity") or testing("Updated") then 444 if testing("Integrity") or testing("Updated") then
439 while 1 < checkExes(download) do os.execute("sleep 30") end 445 while 0 < checkExes(downloadLock) do os.execute("sleep 30") end
440 end 446 end
441 logFile:close() 447 logFile:close()
442end 448end