Changeset 203 for trunk/src/get_swr.sh


Ignore:
Timestamp:
02/11/14 18:41:24 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_swr.sh

    r199 r203  
    1313# ======== 
    1414# 
    15 # :: 
    16 # 
    17 $ get_swr.sh 
     15# .. code-block:: bash 
     16# 
     17  get_swr.sh 
    1818# 
    1919# DESCRIPTION 
     
    4545# ======== 
    4646# 
    47 # You don't have any RAMA reference data, you just have to run this tool :: 
    48 # 
    49 #  $ get_swr.sh 
    50 # 
    51 # And look at log file with :: 
    52 # 
    53 #  $ tlogd.sh get_swr 
     47# You don't have any RAMA reference data, you just have to run this tool : 
     48# 
     49# .. code-block:: bash 
     50# 
     51#    get_swr.sh 
     52# 
     53# And look at log file with : 
     54# 
     55# .. code-block:: bash 
     56# 
     57#    tlogd.sh get_swr 
    5458# 
    5559# and of course on files in ${PROJECT_ID}. 
     
    9296system=$(uname) 
    9397case "${system}" in 
    94    AIX|IRIX64) 
    95       echo "www : no specific posix checking" 
    96       date_cmd=date 
    97    ;; 
    98    Darwin) 
    99       set -o posix 
    100       date_cmd=gdate 
    101    ;; 
    102    Linux) 
    103       set -o posix 
    104       date_cmd=date 
    105    ;; 
    106    *) 
    107      set -o posix 
    108    ;; 
     98    AIX|IRIX64) 
     99        echo "www : no specific posix checking" 
     100        date_cmd=date 
     101    ;; 
     102    Darwin) 
     103        set -o posix 
     104        date_cmd=gdate 
     105    ;; 
     106    Linux) 
     107        set -o posix 
     108        date_cmd=date 
     109    ;; 
     110    *) 
     111        set -o posix 
     112    ;; 
    109113esac 
    110114unset system 
     
    130134if [ ${status} -ne 0 ] 
    131135then 
    132    echo "${command} : eee : tool ${tool} not found" 
    133    exit 1 
     136    echo "${command} : eee : tool ${tool} not found" 
     137    exit 1 
    134138fi 
    135139unset status 
     
    139143if [ "${PROJECT_LOG}" = "" ] 
    140144then 
    141    echo "${command} : eee : \${PROJECT_LOG} not defined" 
    142    exit 1 
     145    echo "${command} : eee : \${PROJECT_LOG} not defined" 
     146    exit 1 
    143147fi 
    144148# 
     
    146150if [ ! -d ${PROJECT_LOG} ] 
    147151then 
    148    echo "${command} : eee : ${PROJECT_LOG} not found" 
    149    exit 1 
     152    echo "${command} : eee : ${PROJECT_LOG} not found" 
     153    exit 1 
    150154fi 
    151155# 
     
    153157if [ ! -x ${PROJECT_LOG} ] 
    154158then 
    155    echo "${command} : eee : ${PROJECT_LOG} not reachable" 
    156    exit 1 
     159    echo "${command} : eee : ${PROJECT_LOG} not reachable" 
     160    exit 1 
    157161fi 
    158162# 
     
    160164if [ ! -w ${PROJECT_LOG} ] 
    161165then 
    162    echo "${command} : eee : ${PROJECT_LOG} not writable" 
    163    exit 1 
     166    echo "${command} : eee : ${PROJECT_LOG} not writable" 
     167    exit 1 
    164168fi 
    165169# 
     
    186190while [ ${yyyy} -le ${yearmax} ] 
    187191do 
    188    for var in ${varlist} 
    189    do 
    190        list_url="${list_url} ${locref}/${var}_isccp_${yyyy}.nc.gz" 
    191    done 
    192    unset var 
    193    yyyy=$(( ${yyyy} + 1 )) 
     192    for var in ${varlist} 
     193    do 
     194        list_url="${list_url} ${locref}/${var}_isccp_${yyyy}.nc.gz" 
     195    done 
     196    unset var 
     197    yyyy=$(( ${yyyy} + 1 )) 
    194198done 
    195199unset varlist 
     
    199203for url in ${list_url} 
    200204do 
    201   file_gz=${PROJECT_ID}/$(basename ${url}) 
    202   file=${PROJECT_ID}/$(basename ${file_gz} .gz) 
    203   if [ ! -f ${file} ] 
    204   then 
    205       if [ ! -f ${file_gz} ] 
    206       then 
    207          wget --tries=1 --no-verbose -P ${PROJECT_ID} \ 
     205    file_gz=${PROJECT_ID}/$(basename ${url}) 
     206    file=${PROJECT_ID}/$(basename ${file_gz} .gz) 
     207    if [ ! -f ${file} ] 
     208    then 
     209        if [ ! -f ${file_gz} ] 
     210        then 
     211            wget --tries=1 --no-verbose -P ${PROJECT_ID} \ 
    208212            ${url} >> ${log} 2>&1 
    209          wget_status=${?} 
    210          if [ ${wget_status} -ne 0 ] 
    211          then 
    212             echo "${command} : eee : ${url} not found" >> ${log} 2>&1 
    213             # ++ exit 1 
    214          else 
    215             echo "${command} : iii : ${url} found" >> ${log} 2>&1 
    216          fi 
    217          unset wget_status 
    218       else 
    219          echo "iii : ${file_gz} exists" >> ${log} 
    220          gunzip -c ${file_gz} > ${file} 
    221       fi 
    222    else 
    223       echo "iii : ${file} exists" >> ${log} 
    224    fi 
     213            wget_status=${?} 
     214            if [ ${wget_status} -ne 0 ] 
     215            then 
     216                echo "${command} : eee : ${url} not found" >> ${log} 2>&1 
     217                # ++ exit 1 
     218            else 
     219                echo "${command} : iii : ${url} found" >> ${log} 2>&1 
     220            fi 
     221            unset wget_status 
     222        else 
     223            echo "iii : ${file_gz} exists" >> ${log} 
     224            gunzip -c ${file_gz} > ${file} 
     225        fi 
     226    else 
     227        echo "iii : ${file} exists" >> ${log} 
     228    fi 
    225229done 
    226230unset file_gz 
Note: See TracChangeset for help on using the changeset viewer.