dsa-check-backuppg: Ignore removed tmp files instead of crashing
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-backuppg
index e7cfd1a..886336f 100755 (executable)
@@ -143,7 +143,15 @@ for dir in os.listdir('.'):
         continue
 
     if not os.path.isdir(dir):
-        if min(os.path.getmtime(dir), os.path.getctime(dir)) + 3600*4 > time.time():
+        try:
+            mtime = os.path.getmtime(dir)
+            ctime = os.path.getctime(dir)
+        except OSError as e:
+            if e.errno == errno.ENOENT:
+                continue
+            else:
+                raise e
+        if min(mtime, ctime) + 3600*4 > time.time():
             note_info('IGNORED', dir)
         else:
             note_warning('NOT-A-DIR', dir)