source: palm/trunk/SCRIPTS/batch_scp @ 2699

Last change on this file since 2699 was 2696, checked in by kanani, 7 years ago

Merge of branch palm4u into trunk

  • Property svn:keywords set to Id
File size: 22.0 KB
Line 
1#! /bin/bash
2
3# batch_scp - script for automatic file/directory transfer using scp
4
5#--------------------------------------------------------------------------------#
6# This file is part of the PALM model system.
7#
8# PALM is free software: you can redistribute it and/or modify it under the terms
9# of the GNU General Public License as published by the Free Software Foundation,
10# either version 3 of the License, or (at your option) any later version.
11#
12# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along with
17# PALM. If not, see <http://www.gnu.org/licenses/>.
18#
19# Copyright 1997-2017  Leibniz Universitaet Hannover
20#--------------------------------------------------------------------------------#
21#
22# Current revisions:
23# ------------------
24#
25#
26# Former revisions:
27# -----------------
28# $Id: batch_scp 2696 2017-12-14 17:12:51Z kanani $
29# cycle numbers made three digits wide
30# host depending code completely removed
31#
32# 2261 2017-06-08 14:25:57Z raasch
33# option usecycle added, script is running under bash now,
34# filenames are allowed to contain arbitrary number of dots "."
35#
36# 1310 2014-03-14 08:01:56Z raasch
37#
38# 1202 2013-07-10 16:22:07Z witha
39# adjustments for Forwind cluster (lcflow): using absolute paths for ssh
40#
41# 1099 2013-02-10 01:47:43Z raasch
42# LANG variable is unset in some ssh calls to guarantee messages in English
43#
44# 1094 2013-02-03 01:52:12Z raasch
45# new option -P for explicit setting of ssh/scp port
46#
47# 1090 2013-02-02 07:06:13Z raasch
48# code put under GPL (PALM 3.9)
49# adjustments for Kyushu-University computing center (lckyut)
50# old changelog messages removed
51#
52# 08/03/11 - Siggi - adjustments for ibmkisti: this machine allows
53#                    outgoing ssh/scp connections only from the
54#                    interactive nodes (gaiad). All ssh/scp traffic is
55#                    done via this interactive node.
56# 04/01/02 - Siggi - first version finished
57# 29/11/01 - Siggi - script development started
58#
59#--------------------------------------------------------------------------------#
60# batch_scp - script for automatic file/directory transfers using scp
61#
62# batch_scp has up to 5 arguments (first 4 are mandatory):
63#               $1 = IP-addres of remote (target) machine
64#               $2 = file to be transferred
65#               $3 = directory of remote machine, where file should be copied to
66#               $4 = filename that file should be given on remote machine
67#               $5 = file extension (optional argument)
68#
69# ATTENTION: problems might occur if directories on remote machine include very
70#            old files for which "ls -al" does give "year" as modification
71#            time instead of "hh:mm". In such a case, batch_scp cannot check the
72#            filename and may not find the file (e.g. if option -g is used).
73#--------------------------------------------------------------------------------#
74
75
76 
77    # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
78 random=$RANDOM
79
80 absolut=false
81 append=false
82 catalog_copy=false
83 check=false
84 cyclestring=""
85 delete=false
86 errfile=batch_scp.errfile.$random
87 filelist=filelist.$random
88 get=false
89 local_host=`hostname`
90 local_wdir=`pwd`
91 locat=normal
92 make_catalog=false
93 overwrite=false
94 print_local_filename=false
95 quote_wait=false
96 remote_user=""
97 silent=false
98 transfermode=binary
99 typeset -i iii icycle maxcycle=0 usecycle wait=0
100
101    # FEHLERBEHANDLUNG
102    # BEI EXIT:
103 trap 'if [[ $locat != normal ]]
104       then
105          [[ -f "$filelist" ]]  &&  cat $filelist
106          [[ -f "$errfile"  ]]  &&  cat $errfile
107          rm -rf $filelist $errfile
108          printf " +++ BATCH_SCP terminated \n"
109          printf "     locat     = $locat \n"
110          printf "     arguments = $1 $2 $3 $4 \n\n"
111          exit 1
112       fi' exit
113
114
115    # BEI TERMINAL-BREAK:
116 trap 'rm -rf $filelist $errfile
117       printf " +++ BATCH_SCP terminated \n\n"
118       exit 1
119      ' 2
120
121
122    # SHELLSCRIPT-OPTIONEN EINLESEN
123 while  getopts  :aAbcCdgmnoP:qsu:U:w:  option
124 do
125   case  $option  in
126       (a)   absolut=true;;
127       (A)   append=true;;
128       (b)   transfermode=binary;;
129       (c)   catalog_copy=true;;
130       (C)   check=true;;
131       (d)   delete=true;;
132       (g)   get=true;;
133       (m)   make_catalog=true;;
134       (n)   print_local_filename=true;;  # Option ist nicht dokumentiert !
135       (o)   overwrite=true;;
136       (P)   scp_port=$OPTARG;;
137       (q)   quote_wait=true;;
138       (s)   silent=true;;
139       (u)   remote_user=$OPTARG;;
140       (U)   usecycle=$OPTARG;;
141       (w)   wait=$OPTARG;;
142       (\?)  printf "  +++ option $OPTARG unknown \n"
143             printf "  --> call: batch_scp [-aAbcCdgmnoqsuw] <IP-adress> <localfile> <remotepath> <remotefile>\n"
144             locat=parameter;exit;;
145   esac
146 done
147
148 (( to_shift = $OPTIND - 1 ))
149 shift $to_shift
150
151
152
153 
154    # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN
155 if [ "$1" = "?" ]
156 then
157   (printf "\n  *** batch_scp can be called as follows:\n"
158    printf "\n      batch_scp -a -b -d -g -o -q -s -u.. -U.. -w..  <param1> <param2> <param3> <param4>\n"
159    printf "\n      Description of available options:\n"
160    printf "\n      Option  Description                            Default-Value"
161    printf "\n        -a    Filenames are absolute. No cycle-      ---"
162    printf "\n              numbers will be determined"
163    printf "\n        -A    append to destination file             ---"
164    printf "\n        -b    use binary-modus for transfer          ASCII-modus"
165    printf "\n        -c    transfer of directory                  ---"
166    printf "\n        -C    check-Modus, no transfer               ---"
167    printf "\n        -d    file to be transferred will be         ---"
168    printf "\n              deleted after successful transfer"
169    printf "\n        -g    change of transfer direction, i.e.     ---"
170    printf "\n              file will be transferred from"
171    printf "\n              destination host"
172    printf "\n        -o    any existing file will be overwritten  ---"
173    printf "\n        -q    switch on  \"quote wait\"  on          ---"
174    printf "\n              estination host"
175    printf "\n        -s    do not display informative messages    ---"
176    printf "\n        -u    username on remote machine             <username>"
177    printf "\n        -U    cycle number to be used                ---"
178    printf "\n        -w    waiting time in seconds, before trans- 0"
179    printf "\n              fer will be initiated"
180    printf "\n "
181    printf "\n      The positional parameters <param1> - <param4> must be provided at"
182    printf "\n      any time and have the following meaning:"
183    printf "\n        <param1>  -  IP-adress of destination host"
184    printf "\n                     or \"?\"  (creates this outline)"
185    printf "\n        <param2>  -  abs. or rel. path of file to be transferred"
186    printf "\n        <param3>  -  directory (abs.!) on destination host. Special cahracters"
187    printf "\n                     like \~ are allowed but must be quoted by \"."
188    printf "\n        <param4>  -  filename (without path!) on destination host; must not"
189    printf "\n                     be given, if option -c is used."
190    printf "\n      When using option -g, file will be copied from destination host to file"
191    printf "\n      <param2>. In this case, no overwriting is possible.") | more
192    exit
193 fi
194
195
196    # PRUEFEN, OB ALLE ARGUMENTE VORLIEGEN
197 if [[ "$1" = "" ]]
198 then
199    printf " +++ 1. argument missing \n"
200    locat=argument; exit
201 elif [[ "$2" = "" ]]
202 then
203    printf " +++ 2. argument missing \n"
204    locat=argument; exit
205 elif [[ "$3" = "" ]]
206 then
207    printf " +++ 3. argument missing \n"
208    locat=argument; exit
209 elif [[ "$4" = "" ]]
210 then
211    printf " +++ 4. argument missing \n"
212    locat=argument; exit
213 fi
214
215
216    # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN
217 if [[ -z $remote_user ]]
218 then
219
220       # PRUEFEN, OB NETRC-DATEI VORHANDEN
221    if [[ ! -f ~/.netrc ]]
222    then
223       printf " +++ option -u not given; \n"
224       printf "     getting remote-username from password file failed \n"
225       printf "     because ~/.netrc does not exist \n"
226       locat=netrc; exit
227    fi
228    grep  $1  ~/.netrc | read dum dum dum remote_user dum dum
229 fi
230
231
232    # APPEND IST NUR BEI TRANSFER EINZELNER DATEIEN OHNE UEBERSCHREIBEN
233    # ERLAUBT. GET IST DABEI EBENFALLS NICHT ERLAUBT
234 if [[ $append = true  &&  ( $get = true || $catalog_copy = true || $overwrite = true ) ]]
235 then
236    printf " +++ options -g, -c and -o are not allowed, if -A is given \n"
237    locat=parameter; exit
238 fi
239
240
241    # QUOTE WAIT FUNKTIONIERT NICHT BEIM KOPIEREN GANZER VERZEICHNISSE
242 if [[ $quote_wait = true  &&  $catalog_copy = true ]]
243 then
244    printf " +++ options  -c  and  -q  must not be used simultaneously\n"
245    locat=parameter; exit
246 fi
247
248
249    # IM CHECK-MODUS WIRD SCRIPT HIER BEENDET
250 [[ $check = true ]]  &&  exit
251
252
253    # BESTIMMTE ZEIT WARTEN, BIS WEITERGEMACHT WIRD (NOETIG Z.B. BEI TRANSFER
254    # VON JOBPROTOKOLLEN AUS JOBS HERAUS)
255 sleep  $wait
256
257
258    # Set port number option for calls of ssh/scp, subjob and batch_scp scripts
259 if [[ "$scp_port" != "" ]]
260 then
261    PORTOPT="-P $scp_port"
262    SSH_PORTOPT="-p $scp_port"
263 fi
264
265
266    # PRUEFEN, OB LOKALE DATEI/LOKALES VERZEICHNIS VORHANDEN BZW. NICHT VORHANDEN
267 if [[ $get = false ]]
268 then
269    if [[ $catalog_copy = false ]]
270    then
271       if [[ ! -f $2 ]]
272       then
273          printf " +++ file \"$2\" to be transferred does not exist \n"
274          locat=localfile; exit
275       fi
276    else
277       if [[ ! -d $2 ]]
278       then
279          printf " +++ directory \"$2\" to be transferred does not exist\n"
280          printf "     or is not a directory \n"
281          locat=localfile; exit
282       fi
283    fi
284 else
285    if [[ $catalog_copy = false ]]
286    then
287       if [[ -f $2 ]]
288       then
289          if [[ $overwrite = true ]]
290          then
291             rm  $2
292          else
293             printf " +++ local file \"$2\" is already existing \n"
294             locat=localfile; exit
295          fi
296       else
297
298             # PRUEFEN, OB SICH LOKALE DATEI ANLEGEN LAESST
299          local_dirname=`dirname $2`
300          if [[ ! -d $local_dirname ]]
301          then
302             printf " +++ local directory \"$local_dirname\" \n"
303             printf "     does not exist or is not a directory \n"
304             printf " +++ cannot copy file \"$3/$4\" \n"
305             printf "     from \"$1\" to \"$local_host\" \n"
306             locat=localfile; exit
307          fi
308       fi
309    else
310       if [[ -d $2  ||  -f $2 ]]
311       then
312          printf " +++ local directory \"$2\" is already existing, \n"
313          printf "     or a file with the same name exists \n"
314          locat=localfile; exit
315       fi
316    fi
317 fi
318
319
320    # VERZEICHNISLSTE DES ZIELRECHNERS ERSTELLEN
321 ssh $SSH_PORTOPT $1 -l $remote_user "unset LANG; cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
322 ssh_status=$?
323
324 if [[ $ssh_status != 0 ]]
325 then
326    if [[ ! -f $filelist ]]
327    then
328       echo " local_host = $local_host   ssh_status = $ssh_status"
329       locat=ssh_failed_1; exit
330    else
331       if [[ $(grep -c "*** list complete" $filelist) = 0 ]]
332       then
333          echo " local_host = $local_host   ssh_status = $ssh_status"
334          locat=ssh_failed_2; exit
335       fi
336    fi
337 fi
338
339
340    # PRUEFEN, OB VERZEICHNIS VORHANDEN IST. WENN GANZES VERZEICHNISS ZUM
341    # ZIELRECHNER KOPIERT WERDEN SOLL, DARF DORT NOCH KEIN ENTSPRECHENDES
342    # VERZEICHNIS VORHANDEN SEIN
343 if [[ $(cat $filelist | grep -c "not found") != 0  || \
344       $(cat $filelist | grep -c "No such file or directory") != 0 ]]
345 then
346    if [[ ! ( $catalog_copy = true  &&  $get = false ) ]]
347    then
348       if [[ $make_catalog = false ]]
349       then
350          printf " +++ directory \"$3\" does not exist on destination host (\"$1\") \n"
351          locat=directory; exit
352       else
353          if [[ $silent = false ]]
354          then
355             printf "  >>> directory \"$3\" does not exist on destination host (\"$1\")"
356             printf "\n      trying to create \"$3\" \n"
357          fi
358
359          make_catalog=force
360       fi
361    fi
362 fi
363
364
365    # PRUEFEN, OB DATEI/VERZEICHNIS VORHANDEN, WENN JA, HOECHSTEN ZYKLUS
366    # ERMITTELN (BZW. IM ABSOLUT-MODUS PRUEFEN, OB DATEI VORHANDEN IST)
367    # DAS GANZE ABER NUR, WENN NICHT OVERWRITE-MODUS GEWAEHLT WURDE, DIE
368    # EVENTUELL VORHANDENE DATEI ALSO UEBERSCHRIEBEN WERDEN SOLL
369 found=false
370 if [[ ( $overwrite = false   &&  $get = false )  ||  $get = true ]]
371 then
372    while  read zeile
373    do
374       if [[ $absolut = false ]]
375       then
376             # REMOVE EXTENSION, IF EXISTING AND GIVEN AS ARGUMENT
377          if [[ "$5" != ""  &&  "$5" != " " ]]
378          then
379             extension=${zeile##*.}
380             if [[ $extension = $5 ]]
381             then
382                text=${zeile%.*}
383             else
384                text=${zeile}
385             fi
386          else
387             text=${zeile}
388          fi
389
390             # GET AND REMOVE CYCLE NUMBER, IF EXISTING, AND CHECK, IF FILE EXISTS
391          cycle=${text##*.}
392          if [[ $cycle = $text ]]
393          then
394                # filename contains no dot, i.e. no cycle number
395             if [[ "$text" = "$4" ]]
396             then
397                found=true
398                (( icycle = 0 ))
399             fi
400          else
401                # filename contains at least one dot
402                # find out if the string after the last dot is a number
403             if [[ $cycle =~ ^-?[0-9]+$ ]]
404             then
405                text=${text%.*}
406                if [[ "$text" = "$4" ]]
407                then
408                   found=true
409                   (( icycle = $cycle ))
410                fi
411             else
412                if [[ "$text" = "$4" ]]
413                then
414                   found=true
415                   (( icycle = 0 ))
416                fi
417             fi
418          fi
419
420          if (( icycle > maxcycle ))
421          then
422             (( maxcycle = icycle ))
423
424                 # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
425                 # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
426              if [[ $(echo $cycle | cut -c1) = 0 ]]
427              then
428                 leading_zero=true
429              else
430                 leading_zero=false
431              fi
432          fi
433
434       else
435
436             # IM ABSOLUT-MODUS MUSS NUR GEPRUEFT WERDEN, OB DIE DATEI
437             # VORHANDEN IST
438          [[ $4 = $zeile ]]  &&  found=true
439       fi
440
441    done <$filelist
442 fi
443
444 if [[ $found = true ]]
445 then
446    if [[ $get = false ]]
447    then
448       if [[ $absolut = false ]]
449       then
450          if [[ $append = false ]]
451          then
452             (( maxcycle = maxcycle + 1 ))
453
454                # TRY TO USE FIXED CYCLE NUMBER, IF GIVEN AS OPTION
455             if [[ "$usecycle" != "" ]]
456             then
457                if (( usecycle >= maxcycle ))
458                then
459                   (( maxcycle = usecycle ))
460                else
461                    printf "  >>> Unfied cycle number cannot be used\n"
462                fi
463             fi
464             cyclestring=`printf ".%03d" $maxcycle`
465          else
466             if (( maxcycle == 0 ))
467             then
468                cyclestring=""
469             else
470                cyclestring=`printf ".%03d" $maxcycle`
471             fi
472          fi
473       else
474          if [[ $overwrite = false ]]
475          then
476             printf "  +++ file \"$3/$4\" \n"
477             printf "      already exists on destination host (use -o, if necessary) \n"
478             locat=file; exit
479          fi
480       fi
481    else
482       if [[ $absolut = false ]]
483       then
484          if (( maxcycle == 0 ))
485          then
486             cyclestring=""
487          else
488
489                # MAKE CYCLE NUMBER THREE DIGITS WIDE
490             if [[ $leading_zero = true ]]
491             then
492                cyclestring=`printf ".%03d" $maxcycle`
493             else
494                cyclestring=.$maxcycle
495             fi
496             (( maxcycle = 0 ))
497          fi
498       else
499          cyclestring=""
500       fi
501    fi
502
503 else
504
505    if [[ "$usecycle" != "" ]]
506    then
507       (( maxcycle = usecycle ))
508       cyclestring=`printf ".%03d" $usecycle`
509    else
510       cyclestring=""
511    fi
512
513       # ABBRUCH, WENN DATEI VON ZIELRECHNER GEHOLT WERDEN SOLL, DORT ABER
514       # NICHT VORHANDEN IST
515    if [[ $get = true ]]
516    then
517       printf " +++ file \"$3/$4\" \n"
518       printf "     does not exist on destination host (\"$1\") \n"
519       locat=remotefile; exit
520    fi
521 fi
522
523
524    # FALLS KATALOG ERZEUGT WIRD, DARF DIE DATEI IN KEINEM FALL EINE
525    # ZYKLUSNUMMER BESITZEN, DA SIE JA NOCh GARNICHT EXISTIEREN KANN
526 if [[ $make_catalog = force ]]
527 then
528    cyclestring=""
529    (( maxcycle = 0 ))
530 fi
531
532 
533    # FALLS NAMENSOPTION (-n) GEWAEHLT WURDE, NUR DEN ERMITTELTEN LOKALEN
534    # DATEINAMEN DES ZIELRECHNERS AUSGEBEN UND SCRIPT BEENDEN
535 if [[ $print_local_filename = true ]]
536 then
537    printf "$4$cyclestring\n"
538    rm -r $filelist
539    exit
540 fi
541
542
543    # FALLS 5. ARGUMENT ANGEGEBEN WURDE, WIRD DIES ALS FILE-EXTENSION
544    # HINTER DIE ZYKLUS-NUMMER GEHAENGT (FUNKTIONIERT NUR BEI KOPIEREN EINER
545    # DATEI AUF ZIELRECHNER
546 if [[ "$5" != ""  &&  $get = false ]]
547 then
548    cyclestring=${cyclestring}.$5
549 fi
550
551
552    # BEI VERZEICHNISTRANSFER VON ZIELRECHNER AUF LOKALEN RECHNER PRUEFEN, OB
553    # $3 AUF ZIELRECHNER WIRKLICH EIN VERZEICHNIS IST
554 if [[ $catalog_copy = true  &&  $get = true ]]
555 then
556
557    rm -rf $filelist
558    ssh $SSH_PORTOPT $1 -l $remote_user "cd $3" > $filelist
559
560    if [[ $? != 0 ]]
561    then
562       locat=ssh_failed_3; exit
563    fi
564
565    if [[ $(cat $filelist | grep -c "Not a directory") != 0 ]]
566    then
567       printf " +++ \"$3\" on destination host is not a directory \n"
568       locat=directory; exit
569    fi
570
571 fi
572
573
574    # BEI KATALOGTRANSFER AUF LOKALEN RECHNER ENTSPRECHENDES VERZEICHNIS
575    # ANLEGEN
576 if [[ $catalog_copy = true ]]
577 then
578    if [[ $get = true ]]
579    then
580       mkdir $2
581    fi
582 fi
583
584
585 catalog_name=$3
586 [[ "$catalog_name" != "" ]]  &&  catalog_name=${catalog_name}/
587
588
589    # DATEI/VERZEICHNIS PER SCP UEBERTRAGEN
590 if [[ $get = false ]]
591 then
592    if [[ $make_catalog != force ]]
593    then
594       if [[ $append = false ]]
595       then
596
597          if [[ $catalog_copy = false ]]
598          then
599             scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
600          else
601             scp $PORTOPT -p -r $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
602          fi
603          scp_status=$?
604
605          if [[ $scp_status != 0 ]]
606          then
607                # CHECK, OB DATEIGROESSEN AUF LOKALEM UND REMOTERECHNER
608                # UEBEREINSTIMMEN
609             local_size=`ls -al  $2`
610             local_size=`echo $local_size | cut -d" " -f5`
611
612             remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al $catalog_name$4$cyclestring"`
613             remote_size=`echo $remote_size | cut -d" " -f5`
614
615             if [[ "$remote_size" != "$local_size" ]]
616             then
617                echo " +++ scp failed on host \"$local_host\" with exit $scp_status"
618                echo "     local size = \"$local_size\"  remote size = \"$remote_size\" "
619                date
620                locat=scp_failed; exit
621             fi
622          fi
623
624       else
625
626          scp $PORTOPT -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
627
628          if [[ $? != 0 ]]
629          then
630                # CHECK, OB DATEIGROESSEN AUF LOKALEM UND REMOTERECHNER
631                # UEBEREINSTIMMEN
632             local_size=`ls -al  $2`
633             local_size=`echo $local_size | cut -d" " -f5`
634
635             remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
636             remote_size=`echo $remote_size | cut -d" " -f5`
637
638             if [[ "$remote_size" != "$local_size" ]]
639             then
640                echo " +++ scp failed on host \"$local_host\" with exit $scp_status"
641                echo "     local size = \"$local_size\"  remote size = \"$remote_size\" "
642                date
643                locat=scp_for_append_failed; exit
644             fi
645          fi
646
647          rm  $filelist
648
649          ssh $SSH_PORTOPT $1 -l $remote_user "cd $3; cat batch_scp_append_file.$random >> $4$cyclestring; rm batch_scp_append_file.$random; echo '*** append complete'" > $filelist
650
651          if [[ $? != 0 ]]
652          then
653             if [[ ! -f $filelist ]]
654             then
655                locat=append_via_ssh_failed; exit
656             else
657                if [[ $(grep -c "*** append complete" $filelist) = 0 ]]
658                then
659                   locat=append_via_ssh_failed; exit
660                fi
661             fi
662          fi
663       fi
664
665    else
666
667       ssh $SSH_PORTOPT $1 -l $remote_user "mkdir -p $3"
668
669       if [[ $? != 0 ]]
670       then
671          locat=ssh_failed_4; exit
672       fi
673
674       scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
675
676       if [[ $? != 0 ]]
677       then
678          locat=scp_failed; exit
679       fi
680    fi
681
682 else
683
684    if [[ $catalog_copy = false ]]
685    then
686       if [[ $quote_wait = true ]]
687       then
688
689          printf " +++ quote wait not realized with BATCH_SCP"
690          locat=unavailable_feature; exit
691
692       else
693
694          scp $PORTOPT -p $remote_user@$1:$catalog_name$4$cyclestring $2  > /dev/null
695
696          if [[ $? != 0 ]]
697          then
698             locat=scp_failed; exit
699          fi
700
701       fi
702
703    else
704
705       printf " +++ get of whole cataloges not realized with BATCH_SCP so far"
706       locat=unavailable_feature; exit
707
708    fi
709
710 fi
711
712
713
714    # EVTL. TRANSFERIERTE DATEI AUF LOKALEM RECHNER LOESCHEN
715 if [[ $delete = true  &&  $get = false ]]
716 then
717    rm -rf  $2
718 fi
719
720
721
722    # ABSCHLUSSMELDUNG
723 if [[ $silent = false ]]
724 then
725    if (( maxcycle == 0 ))
726    then
727       if [[ $append = false ]]
728       then
729          printf "  >>> transfer successful \n"
730       else
731          printf "  >>> file was appended \n"
732       fi
733    else
734       printf "  >>> transfer successful \n"
735       if [[ $append = false ]]
736       then
737          if [[ $catalog_copy = false ]]
738          then
739             printf "      new file has cycle number .%03d \n" $maxcycle
740          else
741             printf "      new catalog has cycle number .%03d \n" $maxcycle
742          fi
743       else
744          printf "      append to cycle number .%03d \n" $maxcycle
745       fi
746    fi
747 fi
748
749 rm -rf  $filelist  $errfile
Note: See TracBrowser for help on using the repository browser.