Ignore:
Timestamp:
Nov 21, 2018 3:44:44 PM (6 years ago)
Author:
raasch
Message:

ssh-call for submitting batch jobs on remote systems modified to avoid output of login messages on specific systems, ssh-calls for compilations on remote systems modified to avoid output of login messages on specific systems, english translation of german comments / variable names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/batch_scp

    r2718 r3549  
    2727# -----------------
    2828# $Id$
     29# english translation of german comments / variable names
     30#
     31# 2718 2018-01-02 08:49:38Z maronga
    2932# Corrected "Former revisions" section
    3033#
     
    8790
    8891 
    89     # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
     92    # VARIABLE DECLARATIONS + DEFAULT VALUES
    9093 random=$RANDOM
    9194
     
    111114 typeset -i iii icycle maxcycle=0 usecycle wait=0
    112115
    113     # FEHLERBEHANDLUNG
    114     # BEI EXIT:
     116
     117    # ERROR HANDLING IN CASE ...
     118    # ... EXIT
    115119 trap 'if [[ $locat != normal ]]
    116120       then
     
    125129
    126130
    127     # BEI TERMINAL-BREAK:
     131    # ... TERMINAL-BREAK:
    128132 trap 'rm -rf $filelist $errfile
    129133       printf " +++ BATCH_SCP terminated \n\n"
     
    132136
    133137
    134     # SHELLSCRIPT-OPTIONEN EINLESEN
     138    # READ SHELLSCRIPT-OPTIONS
    135139 while  getopts  :aAbcCdgmnoP:qsu:U:w:  option
    136140 do
     
    164168
    165169 
    166     # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN
     170    # LIST SHORT DESCRIPTION OF AVAILABLE OPTIONS
    167171 if [ "$1" = "?" ]
    168172 then
     
    194198    printf "\n      any time and have the following meaning:"
    195199    printf "\n        <param1>  -  IP-adress of destination host"
    196     printf "\n                     or \"?\"  (creates this outline)"
     200    printf "\n                     or \"?\"  (creates this short summary of options)"
    197201    printf "\n        <param2>  -  abs. or rel. path of file to be transferred"
    198202    printf "\n        <param3>  -  directory (abs.!) on destination host. Special cahracters"
     
    206210
    207211
    208     # PRUEFEN, OB ALLE ARGUMENTE VORLIEGEN
     212    # CHECK FOR COMPLETENESS OF ARGUMENTS
    209213 if [[ "$1" = "" ]]
    210214 then
     
    229233 if [[ -z $remote_user ]]
    230234 then
    231 
    232        # PRUEFEN, OB NETRC-DATEI VORHANDEN
    233     if [[ ! -f ~/.netrc ]]
    234     then
    235        printf " +++ option -u not given; \n"
    236        printf "     getting remote-username from password file failed \n"
    237        printf "     because ~/.netrc does not exist \n"
    238        locat=netrc; exit
    239     fi
    240     grep  $1  ~/.netrc | read dum dum dum remote_user dum dum
    241  fi
    242 
    243 
    244     # APPEND IST NUR BEI TRANSFER EINZELNER DATEIEN OHNE UEBERSCHREIBEN
    245     # ERLAUBT. GET IST DABEI EBENFALLS NICHT ERLAUBT
     235    printf " +++ option -u is missing \n"
     236    locat=remote_user; exit
     237 fi
     238
     239
     240    # APPEND IS ONLY ALLOWED FOR TRANSFER OF SINGLE FILES WITHOUT OVERWRITING
     241    # IN SUCH A CASE GET IS NOT ALLOWED TOO
    246242 if [[ $append = true  &&  ( $get = true || $catalog_copy = true || $overwrite = true ) ]]
    247243 then
     
    251247
    252248
    253     # QUOTE WAIT FUNKTIONIERT NICHT BEIM KOPIEREN GANZER VERZEICHNISSE
     249    # QUOTE WAIT DOES NOT WORK IF COMPLETE FOLDERS ARE COPIED
    254250 if [[ $quote_wait = true  &&  $catalog_copy = true ]]
    255251 then
     
    259255
    260256
    261     # IM CHECK-MODUS WIRD SCRIPT HIER BEENDET
     257    # SCRIPT WILL BE ENDED HERE IN CASE OF CHECK-MODE
    262258 [[ $check = true ]]  &&  exit
    263259
    264260
    265     # BESTIMMTE ZEIT WARTEN, BIS WEITERGEMACHT WIRD (NOETIG Z.B. BEI TRANSFER
    266     # VON JOBPROTOKOLLEN AUS JOBS HERAUS)
     261    # WAIT A BIT (MAY BE REQUIRED IN CASE OF TRANSFERS OF JOB PROTOCOLS FROM
     262    # WITHIN A JOB)
    267263 sleep  $wait
    268264
    269265
    270     # Set port number option for calls of ssh/scp, subjob and batch_scp scripts
     266    # SET PORT NUMBER OPTION FOR CALLS OF SSH/SCP
    271267 if [[ "$scp_port" != "" ]]
    272268 then
     
    276272
    277273
    278     # PRUEFEN, OB LOKALE DATEI/LOKALES VERZEICHNIS VORHANDEN BZW. NICHT VORHANDEN
     274    # CHECK, IF LOCAL FILE/FOLDER EXISTS
    279275 if [[ $get = false ]]
    280276 then
     
    308304       else
    309305
    310              # PRUEFEN, OB SICH LOKALE DATEI ANLEGEN LAESST
     306             # CHECK, IF LOCAL FILE CAN BE CREATED
    311307          local_dirname=`dirname $2`
    312308          if [[ ! -d $local_dirname ]]
     
    330326
    331327
    332     # VERZEICHNISLSTE DES ZIELRECHNERS ERSTELLEN
     328    # CREATE FILE LIST OF THE TARGET HOST FOLDER
    333329 ssh $SSH_PORTOPT $1 -l $remote_user "unset LANG; cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
    334330 ssh_status=$?
     
    350346
    351347
    352     # PRUEFEN, OB VERZEICHNIS VORHANDEN IST. WENN GANZES VERZEICHNISS ZUM
    353     # ZIELRECHNER KOPIERT WERDEN SOLL, DARF DORT NOCH KEIN ENTSPRECHENDES
    354     # VERZEICHNIS VORHANDEN SEIN
     348    # CHECK, IF FOLDER EXISTS. A FOLDER MUST NOT EXIST, IF COMPLETE FOLDERS
     349    # SHALL BE COPIED TO THE TARGET HOST
    355350 if [[ $(cat $filelist | grep -c "not found") != 0  || \
    356351       $(cat $filelist | grep -c "No such file or directory") != 0 ]]
     
    375370
    376371
    377     # PRUEFEN, OB DATEI/VERZEICHNIS VORHANDEN, WENN JA, HOECHSTEN ZYKLUS
    378     # ERMITTELN (BZW. IM ABSOLUT-MODUS PRUEFEN, OB DATEI VORHANDEN IST)
    379     # DAS GANZE ABER NUR, WENN NICHT OVERWRITE-MODUS GEWAEHLT WURDE, DIE
    380     # EVENTUELL VORHANDENE DATEI ALSO UEBERSCHRIEBEN WERDEN SOLL
     372    # CHECK, IF FILE/FOLDER EXISTS. IF SO, DETERMINE HIGHEST CYCLE NUMBER
     373    # (OR CHECK, IN ABSOLUT-MODE, IF FILE EXSITS)
     374    # BUT DO THIS IN NON-OVERWRITE-MODE ONLY
    381375 found=false
    382376 if [[ ( $overwrite = false   &&  $get = false )  ||  $get = true ]]
    383377 then
    384     while  read zeile
     378    while  read line
    385379    do
    386380       if [[ $absolut = false ]]
     
    389383          if [[ "$5" != ""  &&  "$5" != " " ]]
    390384          then
    391              extension=${zeile##*.}
     385             extension=${line##*.}
    392386             if [[ $extension = $5 ]]
    393387             then
    394                 text=${zeile%.*}
     388                text=${line%.*}
    395389             else
    396                 text=${zeile}
     390                text=${line}
    397391             fi
    398392          else
    399              text=${zeile}
     393             text=${line}
    400394          fi
    401395
     
    446440       else
    447441
    448              # IM ABSOLUT-MODUS MUSS NUR GEPRUEFT WERDEN, OB DIE DATEI
    449              # VORHANDEN IST
    450           [[ $4 = $zeile ]]  &&  found=true
     442             # ABSOLUT-MODE ONLY REQUIRES TO CHECK IF FILE EXISTS
     443          [[ $4 = $line ]]  &&  found=true
    451444       fi
    452445
     
    523516    fi
    524517
    525        # ABBRUCH, WENN DATEI VON ZIELRECHNER GEHOLT WERDEN SOLL, DORT ABER
    526        # NICHT VORHANDEN IST
     518       # EXIT, IF FILE SHALL BE GET FROM THE TARGET HOST, BUT DOESN'T EXIST
    527519    if [[ $get = true ]]
    528520    then
     
    534526
    535527
    536     # FALLS KATALOG ERZEUGT WIRD, DARF DIE DATEI IN KEINEM FALL EINE
    537     # ZYKLUSNUMMER BESITZEN, DA SIE JA NOCh GARNICHT EXISTIEREN KANN
     528    # IF A FOLDER IS CREATED, THE FILENAME MUST NOT CONTAIN A CYCLE NUMBER IN
     529    # ANY CASE, SINCE IT CANNOT HAVE ONE
    538530 if [[ $make_catalog = force ]]
    539531 then
     
    543535
    544536 
    545     # FALLS NAMENSOPTION (-n) GEWAEHLT WURDE, NUR DEN ERMITTELTEN LOKALEN
    546     # DATEINAMEN DES ZIELRECHNERS AUSGEBEN UND SCRIPT BEENDEN
     537    # IF NAME-OPTION (-n) IS CHOSEN, ONLY DETERMINE THE LOCAL FILENAME ON THE
     538    # TARGET HOST AND EXIT THE SCRIPT
    547539 if [[ $print_local_filename = true ]]
    548540 then
     
    553545
    554546
    555     # FALLS 5. ARGUMENT ANGEGEBEN WURDE, WIRD DIES ALS FILE-EXTENSION
    556     # HINTER DIE ZYKLUS-NUMMER GEHAENGT (FUNKTIONIERT NUR BEI KOPIEREN EINER
    557     # DATEI AUF ZIELRECHNER
     547    # IF A 5. ARGUMENT IS GIVEN, IT WILL BE PUT AS FILENAME EXTENSION/APPENDIX
     548    # AFTER THE CYCLE NUMBER (ONLY WORKS IN CASE OF FILE COPY TO THE TARGET HOST)
    558549 if [[ "$5" != ""  &&  $get = false ]]
    559550 then
     
    562553
    563554
    564     # BEI VERZEICHNISTRANSFER VON ZIELRECHNER AUF LOKALEN RECHNER PRUEFEN, OB
    565     # $3 AUF ZIELRECHNER WIRKLICH EIN VERZEICHNIS IST
     555    # IN CASE OF FOLDER TRANSER TO THE TARGET HOST, CHECK IF ARGUMENT $3 REALLY
     556    # REFERS TO A FOLDER ON THE TARGET HOST
    566557 if [[ $catalog_copy = true  &&  $get = true ]]
    567558 then
     
    584575
    585576
    586     # BEI KATALOGTRANSFER AUF LOKALEN RECHNER ENTSPRECHENDES VERZEICHNIS
    587     # ANLEGEN
     577    # IN CASE OF FOLDER TRANSFER FROM THE TARGET HOST TO THE LOCAL HOST,
     578    # CREATE THE RESPECTIVE FOLDER ON THE LOCAL HOST
    588579 if [[ $catalog_copy = true ]]
    589580 then
     
    599590
    600591
    601     # DATEI/VERZEICHNIS PER SCP UEBERTRAGEN
     592    # COPY FILE/FOLDER VIA SCP
    602593 if [[ $get = false ]]
    603594 then
     
    617608          if [[ $scp_status != 0 ]]
    618609          then
    619                 # CHECK, OB DATEIGROESSEN AUF LOKALEM UND REMOTERECHNER
    620                 # UEBEREINSTIMMEN
     610                # CHECK, IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
    621611             local_size=`ls -al  $2`
    622612             local_size=`echo $local_size | cut -d" " -f5`
     
    640630          if [[ $? != 0 ]]
    641631          then
    642                 # CHECK, OB DATEIGROESSEN AUF LOKALEM UND REMOTERECHNER
    643                 # UEBEREINSTIMMEN
     632                # CHECK, OB IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
    644633             local_size=`ls -al  $2`
    645634             local_size=`echo $local_size | cut -d" " -f5`
     
    724713
    725714
    726     # EVTL. TRANSFERIERTE DATEI AUF LOKALEM RECHNER LOESCHEN
     715    # DELETE TRANSFERED FILE ON THE LOCAL HOST
    727716 if [[ $delete = true  &&  $get = false ]]
    728717 then
     
    732721
    733722
    734     # ABSCHLUSSMELDUNG
     723    # FINAL MESSAGES
    735724 if [[ $silent = false ]]
    736725 then
Note: See TracChangeset for help on using the changeset viewer.