From 300beededb82d688ddc887d09f11026a9e68f7d3 Mon Sep 17 00:00:00 2001 From: brent s Date: Mon, 9 Oct 2017 14:45:37 -0400 Subject: [PATCH] doh --- storage/badblocks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/storage/badblocks.py b/storage/badblocks.py index 2a97d77..03ff78b 100755 --- a/storage/badblocks.py +++ b/storage/badblocks.py @@ -32,18 +32,19 @@ def getDisks(): return(disks) def chkDisk(disk): - d = disk.replace('/', '.') - if os.path.isfile('/var/log/badblocks.{0}.log'.format(d)): + d = '.'.join(os.path.split(disk)[1:]) + os.makedirs('/var/log/badblocks', exist_ok = True) + if os.path.isfile('/var/log/badblocks/{0}.log'.format(d)): # for some reason this file was just created within the past 24 hours, # so we better play it safe and write to a different log file now = datetime.datetime.now() - modified = datetime.datetime.fromtimestamp(os.path.getmtime('/var/log/badblocks.{0}.log'.format(d))) + modified = datetime.datetime.fromtimestamp(os.path.getmtime('/var/log/badblocks/{0}.log'.format(d))) diff = now - modified timedelta = datetime.timedelta(days = 1) if not diff >= timedelta: d += '_secondary' bb = ['badblocks', - '-o /var/log/badblocks.{0}.log'.format(d), + '-o /var/log/badblocks/{0}.log'.format(d), disk] smctl = ['smartctl', '-t long',