socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

added diskfree python script

This commit is contained in:
David Starzengruber 2012-05-14 00:13:50 +02:00
parent fb831c494c
commit 45f833157d
1 changed files with 22 additions and 0 deletions

22
df_check.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/python2.7
import os
path=("/boot", "/", "/home/")
print "mountpoints\tfree megabytes"
print "------------------------------"
for mountpoint in path:
if os.path.ismount(mountpoint):
fs = os.statvfs(mountpoint)
freembytes = fs.f_bavail * fs.f_bsize / 1024**2.0
print "%s\t\t%.1f MB" %(mountpoint, freembytes)
else:
print "error: given path is not a mountpoint"
# end of file