Index: /branches/rel_apv_10_7_2/usr/click/tools/webui_graphdb_clear.py
===================================================================
--- /branches/rel_apv_10_7_2/usr/click/tools/webui_graphdb_clear.py	(revision 38834)
+++ /branches/rel_apv_10_7_2/usr/click/tools/webui_graphdb_clear.py	(working copy)
@@ -13,10 +13,14 @@
 var_size_MB = commands.getoutput("df -m | grep ' /var$' | awk '{print $4}'")
 db_percent = float(graphdb_size)*100/float(var_size)
 
+var_used_size = commands.getoutput("df -k | grep ' /var$' | awk '{print $3}'")
+var_used_percent = int(float(var_used_size)*100/float(var_size))
+
 print "The size of var is(KB) : %s" % var_size
 print "The size of graphdb is(KB) : %s" % graphdb_size
 print "The available size of var is(MB) : %s" % var_size_MB
-print "Percentage of graphdb use : %f" % db_percent
+print "Percentage of of var used for graphdb : %f" % db_percent
+print "Percentage of var used : %i" % var_used_percent
 
 db_list = filter(lambda e: e.endswith('.db'), os.listdir(GRAPH_DB_FILE_LIST))
 db_list = sorted(db_list)
@@ -24,8 +28,9 @@
 if len(db_list) > 31:
     print "The earliest db file " + db_list[0] + " is deleted."
     os.popen("rm -rf %s%s*" %(GRAPH_DB_FILE_LIST, db_list[0]))
-elif db_percent < 50 and float(var_size_MB) >= 1.0*1024:
+elif db_percent < 50 and var_used_percent < 90 and float(var_size_MB) >= 1.0*1024:
     # graphdb less than half of var/.
+    # print "graphdb < 50% of var, var used < 90%, no need to free up disk space"
     pass
 else:
     #CURRENT_DB_FILE_NAME = time.strftime("%Y-%m-%d", time.gmtime()) + '.db'
