generating now a dictionary for mountpoints in diskusage.py
This commit is contained in:
parent
57ff13f9df
commit
f92974c8b0
11
diskusage.py
11
diskusage.py
|
@ -60,24 +60,21 @@ partitions = partsnew
|
||||||
blocks = blocksnew
|
blocks = blocksnew
|
||||||
|
|
||||||
# getting mounted partitions and their mountpoints
|
# getting mounted partitions and their mountpoints
|
||||||
mountpoints = []
|
mountpoints = {}
|
||||||
mountparts = []
|
|
||||||
for item in partitions:
|
for item in partitions:
|
||||||
for line in mounts.split("\n"):
|
for line in mounts.split("\n"):
|
||||||
if line and item in line:
|
if line and item in line:
|
||||||
mountpoints.append(line.split()[1])
|
mountpoints[item]=line.split()[1]
|
||||||
mountparts.append(item)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
# output for debugging
|
# output for debugging
|
||||||
print "debug output:"
|
print "debug output:"
|
||||||
print "availible partitions: %s\nblocks: %s\nmounted partitions: %s\nmountpoints: %s" %(partitions, blocks, mountparts, mountpoints)
|
print "availible partitions: %s\nblocks: %s\nmounts: %s" %(partitions, blocks, mountpoints)
|
||||||
print "" #linebreak
|
print "" #linebreak
|
||||||
|
|
||||||
|
|
||||||
# given paths(mountpoints)
|
# given paths(mountpoints)
|
||||||
#path=("/boot", "/", "/dev/sda6")
|
#path=("/boot", "/", "/dev/sda6")
|
||||||
path = mountpoints
|
path = mountpoints.values()
|
||||||
|
|
||||||
print "mountpoints\tfree megabytes"
|
print "mountpoints\tfree megabytes"
|
||||||
print "------------------------------"
|
print "------------------------------"
|
||||||
|
|
Reference in New Issue