]> code.delx.au - monosys/blobdiff - healthcheck/checkspace
Rename all the things
[monosys] / healthcheck / checkspace
similarity index 73%
rename from checkspace
rename to healthcheck/checkspace
index 061263a2f25371d3e9f396e67eb38797a43d2c9f..468b74917d79461a10acec635c8007dcdc3a4a2e 100755 (executable)
@@ -27,12 +27,17 @@ def check_path(path):
     if warn:
         print("WARNING! %s has only %s remaining" % (path, pp_size(free)))
 
+def read_fstab():
+    for line in open("/etc/fstab"):
+        if line.startswith("#"):
+            continue
+        _, path, _ = line.split(maxsplit=2)
+        if path.startswith("/"):
+            yield path
 
 def main():
-    paths = sys.argv[1:]
-    if not paths:
-        print("Usage: %s path" % sys.argv[0])
-        sys.exit(1)
+    paths = set(["/"])
+    paths.update(read_fstab())
     for path in paths:
         check_path(path)