Ignore:
Timestamp:
04/14/12 19:52:40 (12 years ago)
Author:
aclsce
Message:

Added check to be sure there is enough space on temporary filesystems (only on vargas, titane and mercure sx9).
If there is not enough space, we stop.

File:
1 edited

Legend:

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

    r649 r651  
    19681968} 
    19691969 
     1970############################################################ 
     1971# Check of space available on temporary filesytems 
     1972function IGCM_sys_check_quota { 
     1973  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     1974  if ( $DEBUG_sys ) ; then 
     1975    echo "IGCM_sys_check_quota " 
     1976  fi 
     1977  # Limit of quota (in %) 
     1978  limit_quota=90 
     1979 
     1980  # Check of the volume 
     1981  volume_quota=$(ccc_quota | grep ' scratch' | awk '{print $2}') 
     1982  volume_avail=$(ccc_quota | grep ' scratch' | awk '{print $3}') 
     1983 
     1984  if ( [ ! X${volume_quota} = X ] && [ ! ${volume_quota} = "-" ] ) ; then 
     1985 
     1986    unit_avail=${volume_avail: -1} 
     1987    unit_quota=${volume_quota: -1} 
     1988 
     1989    temp_avail=${volume_avail%%${volume_avail: -1}*} 
     1990    temp_quota=${volume_quota%%${volume_quota: -1}*} 
     1991 
     1992    if [ ! ${unit_avail} = ${unit_quota} ] ; then 
     1993 
     1994    # Convertion 
     1995      if [ ${volume_avail: -1} = "T" ] ; then 
     1996        (( temp_avail = temp_avail * 1000000000000 )) 
     1997      elif [ ${volume_avail: -1} = "G" ] ; then 
     1998        (( temp_avail = temp_avail * 1000000000 )) 
     1999      elif [ ${volume_avail: -1} = "M" ] ; then 
     2000        (( temp_avail = temp_avail * 1000000 )) 
     2001      elif [ ${volume_avail: -1} = "k" ] ; then 
     2002        (( temp_avail = temp_avail * 1000 )) 
     2003      else 
     2004        (( temp_avail = volume_avail )) 
     2005      fi 
     2006      if [ ${volume_quota: -1} = "T" ] ; then 
     2007        (( temp_quota = temp_quota * 1000000000000 )) 
     2008      elif [ ${volume_quota: -1} = "G" ] ; then 
     2009        (( temp_quota = temp_quota * 1000000000 )) 
     2010      elif [ ${volume_quota: -1} = "M" ] ; then 
     2011        (( temp_quota = temp_quota * 1000000 )) 
     2012      elif [ ${volume_quota: -1} = "k" ] ; then 
     2013        (( temp_quota = temp_quota * 1000 )) 
     2014      else 
     2015        (( temp_quota = volume_quota )) 
     2016      fi 
     2017    fi 
     2018 
     2019    quota_volume=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) 
     2020#    echo "volume ratio is " $quota_volume 
     2021 
     2022    if [ ${quota_volume} -ge ${limit_quota} ] ; then 
     2023      IGCM_debug_Print 1 "Please, check your quota of volume on scratch" 
     2024      IGCM_debug_Print 1 "Use the ccc_quota command" 
     2025      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2026      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2027      IGCM_debug_Verif_Exit 
     2028    fi 
     2029 
     2030  fi 
     2031 
     2032# Check of the number of inodes 
     2033 
     2034  inode_quota=$(ccc_quota | grep ' scratch' | awk '{print $6}') 
     2035  inode_avail=$(ccc_quota | grep ' scratch' | awk '{print $7}') 
     2036 
     2037  if ( [ ! X${inode_quota} = X ] && [ ! ${inode_quota} = "-" ] ) ; then 
     2038 
     2039    unit_avail=${inode_avail: -1} 
     2040    unit_quota=${inode_quota: -1} 
     2041 
     2042    temp_avail=${inode_avail%%${inode_avail: -1}*} 
     2043    temp_quota=${inode_quota%%${inode_quota: -1}*} 
     2044 
     2045    if [ ! ${unit_avail} = ${unit_quota} ] ; then 
     2046 
     2047    # Convertion 
     2048      if [ ${inode_avail: -1} = "T" ] ; then 
     2049        (( temp_avail = temp_avail * 1000000000000 )) 
     2050      elif [ ${inode_avail: -1} = "G" ] ; then 
     2051        (( temp_avail = temp_avail * 1000000000 )) 
     2052      elif [ ${inode_avail: -1} = "M" ] ; then 
     2053        (( temp_avail = temp_avail * 1000000 )) 
     2054      elif [ ${inode_avail: -1} = "k" ] ; then 
     2055        (( temp_avail = temp_avail * 1000 )) 
     2056      else 
     2057        (( temp_avail = inode_avail )) 
     2058      fi 
     2059 
     2060      if [ ${inode_quota: -1} = "T" ] ; then 
     2061        (( temp_quota = temp_quota * 1000000000000 )) 
     2062      elif [ ${inode_quota: -1} = "G" ] ; then 
     2063        (( temp_quota = temp_quota * 1000000000 )) 
     2064      elif [ ${inode_quota: -1} = "M" ] ; then 
     2065        (( temp_quota = temp_quota * 1000000 )) 
     2066      elif [ ${inode_quota: -1} = "k" ] ; then 
     2067        (( temp_quota = temp_quota * 1000 )) 
     2068      else 
     2069        (( temp_quota = inode_quota )) 
     2070      fi 
     2071    fi 
     2072    quota_inode=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) 
     2073#    echo "inode ratio is " $quota_inode 
     2074 
     2075    if [ ${quota_inode} -ge ${limit_quota} ] ; then 
     2076      IGCM_debug_Print 1 "Please, check your quota of inode on scratch" 
     2077      IGCM_debug_Print 1 "Use the ccc_quota command" 
     2078      IGCM_debug_Print 1 "You must have more than 10% available to run" 
     2079      IGCM_debug_Exit "Not enough space to run ! STOP HERE" 
     2080      IGCM_debug_Verif_Exit 
     2081    fi 
     2082 
     2083  fi 
     2084  IGCM_debug_PopStack "IGCM_sys_check_quota" 
     2085} 
     2086 
    19702087############################################################## 
    19712088# NCO OPERATOR 
Note: See TracChangeset for help on using the changeset viewer.