Ignore:
Timestamp:
01/26/13 23:02:54 (11 years ago)
Author:
sdipsl
Message:

Check curie's quota while running

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh

    r773 r776  
    21162116# Check of space available on temporary filesytems 
    21172117function IGCM_sys_check_quota { 
    2118     IGCM_debug_PushStack "IGCM_sys_check_quota" 
    2119     if ( $DEBUG_sys ) ; then 
    2120         echo "IGCM_sys_check_quota" 
    2121     fi 
    2122     IGCM_debug_PopStack "IGCM_sys_check_quota" 
     2118  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     2119  if ( $DEBUG_sys ) ; then 
     2120    echo "IGCM_sys_check_quota" 
     2121  fi 
     2122  # Limit of quota (in %) 
     2123  limit_quota=90 
     2124 
     2125  # Check of the volume 
     2126  volume_quota=$(ccc_quota | grep ' scratch' | awk '{print $2}') 
     2127  volume_avail=$(ccc_quota | grep ' scratch' | awk '{print $3}') 
     2128 
     2129  if ( [ ! X${volume_quota} = X ] && [ ! ${volume_quota} = "-" ] ) ; then 
     2130 
     2131    unit_avail=${volume_avail: -1} 
     2132    unit_quota=${volume_quota: -1} 
     2133 
     2134    if [ "${unit_quota}" = "*" ] ; then 
     2135        IGCM_debug_Print 1 "Please, check your quota of volume on scratch" 
     2136        IGCM_debug_Print 1 "More than 100% of your quota is used" 
     2137        IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2138        IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2139        IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2140        IGCM_debug_Verif_Exit 
     2141    fi 
     2142 
     2143    temp_avail=${volume_avail%%${volume_avail: -1}*} 
     2144    temp_quota=${volume_quota%%${volume_quota: -1}*} 
     2145 
     2146    if [ ! ${unit_avail} = ${unit_quota} ] ; then 
     2147 
     2148    # Convertion 
     2149      if [ ${volume_avail: -1} = "T" ] ; then 
     2150        (( temp_avail = temp_avail * 1000000000000 )) 
     2151      elif [ ${volume_avail: -1} = "G" ] ; then 
     2152        (( temp_avail = temp_avail * 1000000000 )) 
     2153      elif [ ${volume_avail: -1} = "M" ] ; then 
     2154        (( temp_avail = temp_avail * 1000000 )) 
     2155      elif [ ${volume_avail: -1} = "k" ] ; then 
     2156        (( temp_avail = temp_avail * 1000 )) 
     2157      else 
     2158        (( temp_avail = volume_avail )) 
     2159      fi 
     2160      if [ ${volume_quota: -1} = "T" ] ; then 
     2161        (( temp_quota = temp_quota * 1000000000000 )) 
     2162      elif [ ${volume_quota: -1} = "G" ] ; then 
     2163        (( temp_quota = temp_quota * 1000000000 )) 
     2164      elif [ ${volume_quota: -1} = "M" ] ; then 
     2165        (( temp_quota = temp_quota * 1000000 )) 
     2166      elif [ ${volume_quota: -1} = "k" ] ; then 
     2167        (( temp_quota = temp_quota * 1000 )) 
     2168      else 
     2169        (( temp_quota = volume_quota )) 
     2170      fi 
     2171    fi 
     2172 
     2173    quota_volume=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) 
     2174#    echo "volume ratio is " $quota_volume 
     2175 
     2176    if [ ${quota_volume} -ge ${limit_quota} ] ; then 
     2177      IGCM_debug_Print 1 "Please, check your quota of volume on scratch" 
     2178      IGCM_debug_Print 1 "${quota_volume}% of your quota is used" 
     2179      IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2180      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2181      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2182      IGCM_debug_Verif_Exit 
     2183    fi 
     2184 
     2185  fi 
     2186 
     2187# Check of the number of inodes 
     2188 
     2189  inode_quota=$(ccc_quota | grep ' scratch' | awk '{print $6}') 
     2190  inode_avail=$(ccc_quota | grep ' scratch' | awk '{print $7}') 
     2191 
     2192  if ( [ ! X${inode_quota} = X ] && [ ! ${inode_quota} = "-" ] ) ; then 
     2193 
     2194    unit_avail=${inode_avail: -1} 
     2195    unit_quota=${inode_quota: -1} 
     2196 
     2197    if [ "${unit_quota}" = "*" ] ; then 
     2198        IGCM_debug_Print 1 "Please, check your quota of inode on scratch" 
     2199        IGCM_debug_Print 1 "More than 100% of your quota is used" 
     2200        IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2201        IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2202        IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2203        IGCM_debug_Verif_Exit 
     2204    fi 
     2205 
     2206    temp_avail=${inode_avail%%${inode_avail: -1}*} 
     2207    temp_quota=${inode_quota%%${inode_quota: -1}*} 
     2208 
     2209    if [ ! ${unit_avail} = ${unit_quota} ] ; then 
     2210 
     2211    # Convertion 
     2212      if [ ${inode_avail: -1} = "T" ] ; then 
     2213        (( temp_avail = temp_avail * 1000000000000 )) 
     2214      elif [ ${inode_avail: -1} = "G" ] ; then 
     2215        (( temp_avail = temp_avail * 1000000000 )) 
     2216      elif [ ${inode_avail: -1} = "M" ] ; then 
     2217        (( temp_avail = temp_avail * 1000000 )) 
     2218      elif [ ${inode_avail: -1} = "k" ] ; then 
     2219        (( temp_avail = temp_avail * 1000 )) 
     2220      else 
     2221        (( temp_avail = inode_avail )) 
     2222      fi 
     2223 
     2224      if [ ${inode_quota: -1} = "T" ] ; then 
     2225        (( temp_quota = temp_quota * 1000000000000 )) 
     2226      elif [ ${inode_quota: -1} = "G" ] ; then 
     2227        (( temp_quota = temp_quota * 1000000000 )) 
     2228      elif [ ${inode_quota: -1} = "M" ] ; then 
     2229        (( temp_quota = temp_quota * 1000000 )) 
     2230      elif [ ${inode_quota: -1} = "k" ] ; then 
     2231        (( temp_quota = temp_quota * 1000 )) 
     2232      else 
     2233        (( temp_quota = inode_quota )) 
     2234      fi 
     2235    fi 
     2236    quota_inode=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) 
     2237#    echo "inode ratio is " $quota_inode 
     2238 
     2239    if [ ${quota_inode} -ge ${limit_quota} ] ; then 
     2240      IGCM_debug_Print 1 "Please, check your quota of inode on scratch" 
     2241      IGCM_debug_Print 1 "${quota_inode}% of your quota is used" 
     2242      IGCM_debug_Print 1 "Use the ccc_quota command to check" 
     2243      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2244      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2245      IGCM_debug_Verif_Exit 
     2246    fi 
     2247  fi 
     2248  IGCM_debug_PopStack "IGCM_sys_check_quota" 
    21232249} 
    21242250 
Note: See TracChangeset for help on using the changeset viewer.