Go to the documentation of this file.00001 import os
00002
00003 def disk_usage(path):
00004 """Return disk usage statistics about the given path.
00005
00006 Returned valus is a named tuple with attributes 'total', 'used' and
00007 'free', which are the amount of total, used and free space, in bytes.
00008 """
00009 st = os.statvfs(path)
00010 free = st.f_bavail * st.f_frsize
00011 total = st.f_blocks * st.f_frsize
00012 used = (st.f_blocks - st.f_bfree) * st.f_frsize
00013 return (total, used, free)
00014
00015 def qnx_hdd_check():
00016 ret = True
00017 s = disk_usage('/opt')
00018 print " Check HDD Space .. ",
00019 print " Total %d MB, Used %d MB, Free %d MB\t\t\t" % ( s[0]/(1024*1024), s[1]/(1024*1024), s[2]/(1024*1024)),
00020 if s[2] < 4 * 1024 * 1024 * 1024:
00021 ret = False
00022 print ret
00023 return ret
00024