#! /usr/bin/python #first argument - place where to check disk space (example /var/log); import sys import commands sys.stdout.write("Checking if there is enough space in "+sys.argv[1] + "\t\t\t" ); a=commands.getstatusoutput("df -Ph " + sys.argv[1] +" | grep 'G' | awk '{split ($0,a,\" \"); print a[4]}' ") a=a[1]; a=a[0:-1]; a=float(a); try: if a: a=a; except NameError: sys.exit(1); if a >1.0: sys.exit(0) else: sys.exit(1)