Changeset 4443 for palm


Ignore:
Timestamp:
Mar 5, 2020 3:31:21 PM (15 months ago)
Author:
raasch
Message:

add cycle number to initial files too (000), remove compatibility for cycle numbers which are less than three digits wide

Location:
palm/trunk/SCRIPTS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/batch_scp

    r3549 r4443  
    2727# -----------------
    2828# $Id$
     29# add cycle number to initial files too (000),
     30# remove compatibility for cycle numbers which are less than three digits wide
     31#
     32# 3549 2018-11-21 15:44:44Z raasch
    2933# english translation of german comments / variable names
    3034#
     
    427431          then
    428432             (( maxcycle = icycle ))
    429 
    430                  # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
    431                  # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
    432               if [[ $(echo $cycle | cut -c1) = 0 ]]
    433               then
    434                  leading_zero=true
    435               else
    436                  leading_zero=false
    437               fi
    438433          fi
    439434
     
    464459                   (( maxcycle = usecycle ))
    465460                else
    466                     printf "  >>> Unfied cycle number cannot be used\n"
     461                    printf "  >>> Unified cycle number cannot be used\n"
    467462                fi
    468463             fi
    469              cyclestring=`printf ".%03d" $maxcycle`
    470           else
    471              if (( maxcycle == 0 ))
    472              then
    473                 cyclestring=""
    474              else
    475                 cyclestring=`printf ".%03d" $maxcycle`
    476              fi
    477           fi
     464          fi
     465          cyclestring=`printf ".%03d" $maxcycle`
    478466       else
    479467          if [[ $overwrite = false ]]
     
    487475       if [[ $absolut = false ]]
    488476       then
    489           if (( maxcycle == 0 ))
    490           then
    491              cyclestring=""
    492           else
    493 
    494                 # MAKE CYCLE NUMBER THREE DIGITS WIDE
    495              if [[ $leading_zero = true ]]
    496              then
    497                 cyclestring=`printf ".%03d" $maxcycle`
    498              else
    499                 cyclestring=.$maxcycle
    500              fi
    501              (( maxcycle = 0 ))
    502           fi
     477             # MAKE CYCLE NUMBER THREE DIGITS WIDE
     478          cyclestring=`printf ".%03d" $maxcycle`
    503479       else
    504480          cyclestring=""
     
    511487    then
    512488       (( maxcycle = usecycle ))
    513        cyclestring=`printf ".%03d" $usecycle`
    514     else
    515        cyclestring=""
    516     fi
     489    fi
     490    cyclestring=`printf ".%03d" $maxcycle`
    517491
    518492       # EXIT, IF FILE SHALL BE GET FROM THE TARGET HOST, BUT DOESN'T EXIST
     
    526500
    527501
    528     # IF A FOLDER IS CREATED, THE FILENAME MUST NOT CONTAIN A CYCLE NUMBER IN
    529     # ANY CASE, SINCE IT CANNOT HAVE ONE
    530  if [[ $make_catalog = force ]]
    531  then
    532     cyclestring=""
    533     (( maxcycle = 0 ))
    534  fi
    535 
    536  
    537502    # IF NAME-OPTION (-n) IS CHOSEN, ONLY DETERMINE THE LOCAL FILENAME ON THE
    538503    # TARGET HOST AND EXIT THE SCRIPT
     
    630595          if [[ $? != 0 ]]
    631596          then
    632                 # CHECK, OB IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
     597                # CHECK, IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
    633598             local_size=`ls -al  $2`
    634599             local_size=`echo $local_size | cut -d" " -f5`
  • palm/trunk/SCRIPTS/palmrun

    r4425 r4443  
    2727# -----------------
    2828# $Id$
     29# add cycle number to initial files too (000),
     30# remove compatibility for cycle numbers which are less than three digits wide
     31#
     32# 4425 2020-02-26 15:35:00Z raasch
    2933# hard coded path to the fileconnection file replaced by a path that is based on
    3034# the source path which has been given in the configuration file
     
    13551359          while  read line
    13561360          do
    1357                  # filename without path (i.e. after the last "/")
    1358               basefilename=$(basename ${line})
     1361                # filename without path (i.e. after the last "/")
     1362             basefilename=$(basename ${line})
    13591363   
    1360                  # check if there is an extension
    1361               extension=${basefilename##*.}
    1362               if [[ "$extension" = "${extin[$nr_of_input_files]}" ]]
    1363               then
    1364                  basefilename=${basefilename%.*}
    1365               fi
     1364                # check if there is an extension
     1365             extension=${basefilename##*.}
     1366             if [[ "$extension" = "${extin[$nr_of_input_files]}" ]]
     1367             then
     1368                basefilename=${basefilename%.*}
     1369             fi
    13661370   
    1367                  # check for an existing cycle number
    1368               cycle=${basefilename##*.}
    1369               if [[ $cycle =~ ^-?[0-9]+$ ]]
    1370               then
    1371                     # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
    1372                     # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
    1373                  (( icycle = $((10#$cycle)) ))
    1374               else
    1375                  (( icycle = 0 ))
    1376               fi
     1371                # check for an existing cycle number
     1372             cycle=${basefilename##*.}
     1373             if [[ $cycle =~ ^-?[0-9]+$ ]]
     1374             then
     1375                   # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
     1376                   # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
     1377                (( icycle = $((10#$cycle)) ))
     1378                explicit_cycle_number=true
     1379             else
     1380                (( icycle = 0 ))
     1381                explicit_cycle_number=false
     1382             fi
    13771383   
    1378               if (( icycle > maxcycle ))
    1379               then
    1380                  (( maxcycle = icycle ))
    1381    
    1382                     # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
    1383                     # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
    1384                  if [[ $(echo $cycle | cut -c1) = 0 ]]
    1385                  then
    1386                     leading_zero=true
    1387                  else
    1388                     leading_zero=false
    1389                  fi
    1390               fi
     1384             if (( icycle > maxcycle ))
     1385             then
     1386                (( maxcycle = icycle ))
     1387             fi
    13911388   
    13921389          done <filelist
    13931390          rm filelist
     1391
    13941392   
    13951393             # MAKE CYCLE NUMBER THREE DIGITS WIDE
    1396           if [[ $leading_zero = true ]]
    1397           then
    1398              cyclestring=`printf "%03d" $maxcycle`
    1399           else
    1400              cyclestring=$maxcycle
    1401           fi
     1394          cyclestring=`printf "%03d" $maxcycle`
     1395
    14021396   
    14031397             # APPEND CYCLE NUMBER TO FILENAME
    1404           if (( maxcycle > 0 ))
     1398          if [[ $explicit_cycle_number = true ]]
    14051399          then
    14061400             if [[ "${extin[$nr_of_input_files]}" != " "  &&   "${extin[$nr_of_input_files]}" != "" ]]
     
    14201414             # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE)
    14211415          absnamein[$nr_of_input_files]=$filename
    1422           if (( maxcycle > 0 ))
     1416          if [[ $explicit_cycle_number = true ]]
    14231417          then
    14241418             if [[ "${actionin[$nr_of_input_files]}" = di ]]
     
    19961990    if [[ $running_in_batch_mode = false ]]
    19971991    then
     1992
    19981993          # CREATE THE DIRECTORY
    19991994       mkdir -p  $tempdir
     
    21662161                                 ln -f  ${absnamein[$i]}  ${localin[$i]}
    21672162                        fi
    2168                                 # If "ln -f" fails or if "$link_local_input = false" do a normal "cp"
     2163                                # IF "ln -f" FAILS OR IF "$link_local_input = false" DO A NORMAL "cp"
    21692164                        if [[ ! -f "${localin[$i]}" ]]
    21702165                then
     
    24942489          ls -1 -d $filename    >   filelist  2>/dev/null
    24952490          ls -1 -d $filename.*  >>  filelist  2>/dev/null
     2491          (( maxcycle = 0 ))
    24962492          while  read line
    24972493          do
     
    25312527          if [[ "${actionout[$i]}" = a ]]
    25322528          then
    2533              (( maxcycle = maxcycle - 1 ))
     2529             if (( maxcycle > 0 ))
     2530             then
     2531                (( maxcycle = maxcycle - 1 ))
     2532             fi
    25342533          fi
    25352534         
     
    25542553             fi
    25552554          fi
    2556           if (( cycnum[$i] > 0 ))
    2557           then
    2558              cyclestring=`printf "%03d" ${cycnum[$i]}`
    2559              pathout[$i]=${pathout[$i]}.$cyclestring
    2560           fi
    2561        fi           
     2555          cyclestring=`printf "%03d" ${cycnum[$i]}`
     2556          pathout[$i]=${pathout[$i]}.$cyclestring
     2557       fi
    25622558
    25632559          # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION)
Note: See TracChangeset for help on using the changeset viewer.