diff --git a/df_check.py b/df_check.py index 7b8a695..3df01c5 100755 --- a/df_check.py +++ b/df_check.py @@ -2,6 +2,7 @@ import os + #fileoperations file = open("/proc/partitions", "r") parts = file.read() @@ -13,7 +14,6 @@ file.close() #definitions partitions = [] blocks = [] -mountpoints = [] # getting all local partitions (regardless if mounted or not) for line in parts.split("\n"): @@ -31,13 +31,10 @@ partsnew = [] blocksnew = [] for part in partitions: if hold in part: - print "part %s contains hold %s" %(part, hold) blockcount = blockcount + int(blocks[counter]) - print blockcount partsnew.append(part) blocksnew.append(blocks[counter]) else: - print "part %s does not contain hold %s" %(part, hold) hold = part holdblocks = blocks[counter] blockcount = 0 @@ -47,29 +44,22 @@ partitions = partsnew blocks = blocksnew - #getting mountpoints to devices -counter = 0 +mountpoints = [] for item in partitions: for line in mounts.split("\n"): if line and item in line: mountpoints.append(line.split()[1]) - - if line.split()[1] not in mountpoints[counter]: - mountpoints.append("%s not mounted" %(item)) - counter += 1 - + break print "partitions: %s\nblocks: %s\nmountpoints: %s" %(partitions, blocks, mountpoints) - - -exit() - +print "\n" # given paths(mountpoints) -path=("/boot", "/", "/dev/sda6") +#path=("/boot", "/", "/dev/sda6") +path = mountpoints #output head print "mountpoints\tfree megabytes"