Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 773)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 776)
@@ -2116,9 +2116,135 @@
 # Check of space available on temporary filesytems
 function IGCM_sys_check_quota {
-    IGCM_debug_PushStack "IGCM_sys_check_quota"
-    if ( $DEBUG_sys ) ; then
-        echo "IGCM_sys_check_quota"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_check_quota"
+  IGCM_debug_PushStack "IGCM_sys_check_quota"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_check_quota"
+  fi
+  # Limit of quota (in %)
+  limit_quota=90
+
+  # Check of the volume
+  volume_quota=$(ccc_quota | grep ' scratch' | awk '{print $2}')
+  volume_avail=$(ccc_quota | grep ' scratch' | awk '{print $3}')
+
+  if ( [ ! X${volume_quota} = X ] && [ ! ${volume_quota} = "-" ] ) ; then
+
+    unit_avail=${volume_avail: -1}
+    unit_quota=${volume_quota: -1}
+
+    if [ "${unit_quota}" = "*" ] ; then
+        IGCM_debug_Print 1 "Please, check your quota of volume on scratch"
+        IGCM_debug_Print 1 "More than 100% of your quota is used"
+        IGCM_debug_Print 1 "Use the ccc_quota command to check"
+        IGCM_debug_Print 1 "You must have more than 10% available to run"
+        IGCM_debug_Exit "Not enough space to run ! STOP HERE"
+        IGCM_debug_Verif_Exit
+    fi
+
+    temp_avail=${volume_avail%%${volume_avail: -1}*}
+    temp_quota=${volume_quota%%${volume_quota: -1}*}
+
+    if [ ! ${unit_avail} = ${unit_quota} ] ; then
+
+    # Convertion
+      if [ ${volume_avail: -1} = "T" ] ; then
+        (( temp_avail = temp_avail * 1000000000000 ))
+      elif [ ${volume_avail: -1} = "G" ] ; then
+        (( temp_avail = temp_avail * 1000000000 ))
+      elif [ ${volume_avail: -1} = "M" ] ; then
+        (( temp_avail = temp_avail * 1000000 ))
+      elif [ ${volume_avail: -1} = "k" ] ; then
+        (( temp_avail = temp_avail * 1000 ))
+      else
+        (( temp_avail = volume_avail ))
+      fi
+      if [ ${volume_quota: -1} = "T" ] ; then
+        (( temp_quota = temp_quota * 1000000000000 ))
+      elif [ ${volume_quota: -1} = "G" ] ; then
+        (( temp_quota = temp_quota * 1000000000 ))
+      elif [ ${volume_quota: -1} = "M" ] ; then
+        (( temp_quota = temp_quota * 1000000 ))
+      elif [ ${volume_quota: -1} = "k" ] ; then
+        (( temp_quota = temp_quota * 1000 ))
+      else
+        (( temp_quota = volume_quota ))
+      fi
+    fi
+
+    quota_volume=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc)
+#    echo "volume ratio is " $quota_volume
+
+    if [ ${quota_volume} -ge ${limit_quota} ] ; then
+      IGCM_debug_Print 1 "Please, check your quota of volume on scratch"
+      IGCM_debug_Print 1 "${quota_volume}% of your quota is used"
+      IGCM_debug_Print 1 "Use the ccc_quota command to check"
+      IGCM_debug_Print 1 "You must have more than 10% available to run"
+      IGCM_debug_Exit "Not enough space to run ! STOP HERE"
+      IGCM_debug_Verif_Exit
+    fi
+
+  fi
+
+# Check of the number of inodes
+
+  inode_quota=$(ccc_quota | grep ' scratch' | awk '{print $6}')
+  inode_avail=$(ccc_quota | grep ' scratch' | awk '{print $7}')
+
+  if ( [ ! X${inode_quota} = X ] && [ ! ${inode_quota} = "-" ] ) ; then
+
+    unit_avail=${inode_avail: -1}
+    unit_quota=${inode_quota: -1}
+
+    if [ "${unit_quota}" = "*" ] ; then
+        IGCM_debug_Print 1 "Please, check your quota of inode on scratch"
+        IGCM_debug_Print 1 "More than 100% of your quota is used"
+        IGCM_debug_Print 1 "Use the ccc_quota command to check"
+        IGCM_debug_Print 1 "You must have more than 10% available to run"
+        IGCM_debug_Exit "Not enough space to run ! STOP HERE"
+        IGCM_debug_Verif_Exit
+    fi
+
+    temp_avail=${inode_avail%%${inode_avail: -1}*}
+    temp_quota=${inode_quota%%${inode_quota: -1}*}
+
+    if [ ! ${unit_avail} = ${unit_quota} ] ; then
+
+    # Convertion
+      if [ ${inode_avail: -1} = "T" ] ; then
+        (( temp_avail = temp_avail * 1000000000000 ))
+      elif [ ${inode_avail: -1} = "G" ] ; then
+        (( temp_avail = temp_avail * 1000000000 ))
+      elif [ ${inode_avail: -1} = "M" ] ; then
+        (( temp_avail = temp_avail * 1000000 ))
+      elif [ ${inode_avail: -1} = "k" ] ; then
+        (( temp_avail = temp_avail * 1000 ))
+      else
+        (( temp_avail = inode_avail ))
+      fi
+
+      if [ ${inode_quota: -1} = "T" ] ; then
+        (( temp_quota = temp_quota * 1000000000000 ))
+      elif [ ${inode_quota: -1} = "G" ] ; then
+        (( temp_quota = temp_quota * 1000000000 ))
+      elif [ ${inode_quota: -1} = "M" ] ; then
+        (( temp_quota = temp_quota * 1000000 ))
+      elif [ ${inode_quota: -1} = "k" ] ; then
+        (( temp_quota = temp_quota * 1000 ))
+      else
+        (( temp_quota = inode_quota ))
+      fi
+    fi
+    quota_inode=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc)
+#    echo "inode ratio is " $quota_inode
+
+    if [ ${quota_inode} -ge ${limit_quota} ] ; then
+      IGCM_debug_Print 1 "Please, check your quota of inode on scratch"
+      IGCM_debug_Print 1 "${quota_inode}% of your quota is used"
+      IGCM_debug_Print 1 "Use the ccc_quota command to check"
+      IGCM_debug_Print 1 "You must have more than 10% available to run"
+      IGCM_debug_Exit "Not enough space to run ! STOP HERE"
+      IGCM_debug_Verif_Exit
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_check_quota"
 }
 
