source: palm/trunk/SCRIPTS/batch_scp @ 4216

Last change on this file since 4216 was 3549, checked in by raasch, 6 years ago

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

  • Property svn:keywords set to Id
File size: 21.8 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-2018  Leibniz Universitaet Hannover
20#--------------------------------------------------------------------------------#
21#
22# Current revisions:
23# ------------------
24#
25#
26# Former revisions:
27# -----------------
28# $Id: batch_scp 3549 2018-11-21 15:44:44Z suehring $
29# english translation of german comments / variable names
30#
31# 2718 2018-01-02 08:49:38Z maronga
32# Corrected "Former revisions" section
33#
34# 2715 2017-12-27 11:31:43Z raasch
35# last commit documented
36#
37# 2714 2017-12-27 11:25:57Z raasch
38# bugfix: variable cycle explicitly interpreted with 10 as the number base
39#
40# 2696 2017-12-14 17:12:51Z kanani
41# Change in file header (GPL part)
42#
43# 2600 2017-11-01 14:11:20Z raasch
44# cycle numbers made three digits wide
45# host depending code completely removed
46#
47# 2261 2017-06-08 14:25:57Z raasch
48# option usecycle added, script is running under bash now,
49# filenames are allowed to contain arbitrary number of dots "."
50#
51# 1310 2014-03-14 08:01:56Z raasch
52#
53# 1202 2013-07-10 16:22:07Z witha
54# adjustments for Forwind cluster (lcflow): using absolute paths for ssh
55#
56# 1099 2013-02-10 01:47:43Z raasch
57# LANG variable is unset in some ssh calls to guarantee messages in English
58#
59# 1094 2013-02-03 01:52:12Z raasch
60# new option -P for explicit setting of ssh/scp port
61#
62# 1090 2013-02-02 07:06:13Z raasch
63# code put under GPL (PALM 3.9)
64# adjustments for Kyushu-University computing center (lckyut)
65# old changelog messages removed
66#
67# 08/03/11 - Siggi - adjustments for ibmkisti: this machine allows
68#                    outgoing ssh/scp connections only from the
69#                    interactive nodes (gaiad). All ssh/scp traffic is
70#                    done via this interactive node.
71# 04/01/02 - Siggi - first version finished
72# 29/11/01 - Siggi - script development started
73#
74#--------------------------------------------------------------------------------#
75# batch_scp - script for automatic file/directory transfers using scp
76#
77# batch_scp has up to 5 arguments (first 4 are mandatory):
78#               $1 = IP-addres of remote (target) machine
79#               $2 = file to be transferred
80#               $3 = directory of remote machine, where file should be copied to
81#               $4 = filename that file should be given on remote machine
82#               $5 = file extension (optional argument)
83#
84# ATTENTION: problems might occur if directories on remote machine include very
85#            old files for which "ls -al" does give "year" as modification
86#            time instead of "hh:mm". In such a case, batch_scp cannot check the
87#            filename and may not find the file (e.g. if option -g is used).
88#--------------------------------------------------------------------------------#
89
90
91 
92    # VARIABLE DECLARATIONS + DEFAULT VALUES
93 random=$RANDOM
94
95 absolut=false
96 append=false
97 catalog_copy=false
98 check=false
99 cyclestring=""
100 delete=false
101 errfile=batch_scp.errfile.$random
102 filelist=filelist.$random
103 get=false
104 local_host=`hostname`
105 local_wdir=`pwd`
106 locat=normal
107 make_catalog=false
108 overwrite=false
109 print_local_filename=false
110 quote_wait=false
111 remote_user=""
112 silent=false
113 transfermode=binary
114 typeset -i iii icycle maxcycle=0 usecycle wait=0
115
116
117    # ERROR HANDLING IN CASE ...
118    # ... EXIT
119 trap 'if [[ $locat != normal ]]
120       then
121          [[ -f "$filelist" ]]  &&  cat $filelist
122          [[ -f "$errfile"  ]]  &&  cat $errfile
123          rm -rf $filelist $errfile
124          printf " +++ BATCH_SCP terminated \n"
125          printf "     locat     = $locat \n"
126          printf "     arguments = $1 $2 $3 $4 \n\n"
127          exit 1
128       fi' exit
129
130
131    # ... TERMINAL-BREAK:
132 trap 'rm -rf $filelist $errfile
133       printf " +++ BATCH_SCP terminated \n\n"
134       exit 1
135      ' 2
136
137
138    # READ SHELLSCRIPT-OPTIONS
139 while  getopts  :aAbcCdgmnoP:qsu:U:w:  option
140 do
141   case  $option  in
142       (a)   absolut=true;;
143       (A)   append=true;;
144       (b)   transfermode=binary;;
145       (c)   catalog_copy=true;;
146       (C)   check=true;;
147       (d)   delete=true;;
148       (g)   get=true;;
149       (m)   make_catalog=true;;
150       (n)   print_local_filename=true;;  # Option ist nicht dokumentiert !
151       (o)   overwrite=true;;
152       (P)   scp_port=$OPTARG;;
153       (q)   quote_wait=true;;
154       (s)   silent=true;;
155       (u)   remote_user=$OPTARG;;
156       (U)   usecycle=$OPTARG;;
157       (w)   wait=$OPTARG;;
158       (\?)  printf "  +++ option $OPTARG unknown \n"
159             printf "  --> call: batch_scp [-aAbcCdgmnoqsuw] <IP-adress> <localfile> <remotepath> <remotefile>\n"
160             locat=parameter;exit;;
161   esac
162 done
163
164 (( to_shift = $OPTIND - 1 ))
165 shift $to_shift
166
167
168
169 
170    # LIST SHORT DESCRIPTION OF AVAILABLE OPTIONS
171 if [ "$1" = "?" ]
172 then
173   (printf "\n  *** batch_scp can be called as follows:\n"
174    printf "\n      batch_scp -a -b -d -g -o -q -s -u.. -U.. -w..  <param1> <param2> <param3> <param4>\n"
175    printf "\n      Description of available options:\n"
176    printf "\n      Option  Description                            Default-Value"
177    printf "\n        -a    Filenames are absolute. No cycle-      ---"
178    printf "\n              numbers will be determined"
179    printf "\n        -A    append to destination file             ---"
180    printf "\n        -b    use binary-modus for transfer          ASCII-modus"
181    printf "\n        -c    transfer of directory                  ---"
182    printf "\n        -C    check-Modus, no transfer               ---"
183    printf "\n        -d    file to be transferred will be         ---"
184    printf "\n              deleted after successful transfer"
185    printf "\n        -g    change of transfer direction, i.e.     ---"
186    printf "\n              file will be transferred from"
187    printf "\n              destination host"
188    printf "\n        -o    any existing file will be overwritten  ---"
189    printf "\n        -q    switch on  \"quote wait\"  on          ---"
190    printf "\n              estination host"
191    printf "\n        -s    do not display informative messages    ---"
192    printf "\n        -u    username on remote machine             <username>"
193    printf "\n        -U    cycle number to be used                ---"
194    printf "\n        -w    waiting time in seconds, before trans- 0"
195    printf "\n              fer will be initiated"
196    printf "\n "
197    printf "\n      The positional parameters <param1> - <param4> must be provided at"
198    printf "\n      any time and have the following meaning:"
199    printf "\n        <param1>  -  IP-adress of destination host"
200    printf "\n                     or \"?\"  (creates this short summary of options)"
201    printf "\n        <param2>  -  abs. or rel. path of file to be transferred"
202    printf "\n        <param3>  -  directory (abs.!) on destination host. Special cahracters"
203    printf "\n                     like \~ are allowed but must be quoted by \"."
204    printf "\n        <param4>  -  filename (without path!) on destination host; must not"
205    printf "\n                     be given, if option -c is used."
206    printf "\n      When using option -g, file will be copied from destination host to file"
207    printf "\n      <param2>. In this case, no overwriting is possible.") | more
208    exit
209 fi
210
211
212    # CHECK FOR COMPLETENESS OF ARGUMENTS
213 if [[ "$1" = "" ]]
214 then
215    printf " +++ 1. argument missing \n"
216    locat=argument; exit
217 elif [[ "$2" = "" ]]
218 then
219    printf " +++ 2. argument missing \n"
220    locat=argument; exit
221 elif [[ "$3" = "" ]]
222 then
223    printf " +++ 3. argument missing \n"
224    locat=argument; exit
225 elif [[ "$4" = "" ]]
226 then
227    printf " +++ 4. argument missing \n"
228    locat=argument; exit
229 fi
230
231
232    # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN
233 if [[ -z $remote_user ]]
234 then
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
242 if [[ $append = true  &&  ( $get = true || $catalog_copy = true || $overwrite = true ) ]]
243 then
244    printf " +++ options -g, -c and -o are not allowed, if -A is given \n"
245    locat=parameter; exit
246 fi
247
248
249    # QUOTE WAIT DOES NOT WORK IF COMPLETE FOLDERS ARE COPIED
250 if [[ $quote_wait = true  &&  $catalog_copy = true ]]
251 then
252    printf " +++ options  -c  and  -q  must not be used simultaneously\n"
253    locat=parameter; exit
254 fi
255
256
257    # SCRIPT WILL BE ENDED HERE IN CASE OF CHECK-MODE
258 [[ $check = true ]]  &&  exit
259
260
261    # WAIT A BIT (MAY BE REQUIRED IN CASE OF TRANSFERS OF JOB PROTOCOLS FROM
262    # WITHIN A JOB)
263 sleep  $wait
264
265
266    # SET PORT NUMBER OPTION FOR CALLS OF SSH/SCP
267 if [[ "$scp_port" != "" ]]
268 then
269    PORTOPT="-P $scp_port"
270    SSH_PORTOPT="-p $scp_port"
271 fi
272
273
274    # CHECK, IF LOCAL FILE/FOLDER EXISTS
275 if [[ $get = false ]]
276 then
277    if [[ $catalog_copy = false ]]
278    then
279       if [[ ! -f $2 ]]
280       then
281          printf " +++ file \"$2\" to be transferred does not exist \n"
282          locat=localfile; exit
283       fi
284    else
285       if [[ ! -d $2 ]]
286       then
287          printf " +++ directory \"$2\" to be transferred does not exist\n"
288          printf "     or is not a directory \n"
289          locat=localfile; exit
290       fi
291    fi
292 else
293    if [[ $catalog_copy = false ]]
294    then
295       if [[ -f $2 ]]
296       then
297          if [[ $overwrite = true ]]
298          then
299             rm  $2
300          else
301             printf " +++ local file \"$2\" is already existing \n"
302             locat=localfile; exit
303          fi
304       else
305
306             # CHECK, IF LOCAL FILE CAN BE CREATED
307          local_dirname=`dirname $2`
308          if [[ ! -d $local_dirname ]]
309          then
310             printf " +++ local directory \"$local_dirname\" \n"
311             printf "     does not exist or is not a directory \n"
312             printf " +++ cannot copy file \"$3/$4\" \n"
313             printf "     from \"$1\" to \"$local_host\" \n"
314             locat=localfile; exit
315          fi
316       fi
317    else
318       if [[ -d $2  ||  -f $2 ]]
319       then
320          printf " +++ local directory \"$2\" is already existing, \n"
321          printf "     or a file with the same name exists \n"
322          locat=localfile; exit
323       fi
324    fi
325 fi
326
327
328    # CREATE FILE LIST OF THE TARGET HOST FOLDER
329 ssh $SSH_PORTOPT $1 -l $remote_user "unset LANG; cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
330 ssh_status=$?
331
332 if [[ $ssh_status != 0 ]]
333 then
334    if [[ ! -f $filelist ]]
335    then
336       echo " local_host = $local_host   ssh_status = $ssh_status"
337       locat=ssh_failed_1; exit
338    else
339       if [[ $(grep -c "*** list complete" $filelist) = 0 ]]
340       then
341          echo " local_host = $local_host   ssh_status = $ssh_status"
342          locat=ssh_failed_2; exit
343       fi
344    fi
345 fi
346
347
348    # CHECK, IF FOLDER EXISTS. A FOLDER MUST NOT EXIST, IF COMPLETE FOLDERS
349    # SHALL BE COPIED TO THE TARGET HOST
350 if [[ $(cat $filelist | grep -c "not found") != 0  || \
351       $(cat $filelist | grep -c "No such file or directory") != 0 ]]
352 then
353    if [[ ! ( $catalog_copy = true  &&  $get = false ) ]]
354    then
355       if [[ $make_catalog = false ]]
356       then
357          printf " +++ directory \"$3\" does not exist on destination host (\"$1\") \n"
358          locat=directory; exit
359       else
360          if [[ $silent = false ]]
361          then
362             printf "  >>> directory \"$3\" does not exist on destination host (\"$1\")"
363             printf "\n      trying to create \"$3\" \n"
364          fi
365
366          make_catalog=force
367       fi
368    fi
369 fi
370
371
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
375 found=false
376 if [[ ( $overwrite = false   &&  $get = false )  ||  $get = true ]]
377 then
378    while  read line
379    do
380       if [[ $absolut = false ]]
381       then
382             # REMOVE EXTENSION, IF EXISTING AND GIVEN AS ARGUMENT
383          if [[ "$5" != ""  &&  "$5" != " " ]]
384          then
385             extension=${line##*.}
386             if [[ $extension = $5 ]]
387             then
388                text=${line%.*}
389             else
390                text=${line}
391             fi
392          else
393             text=${line}
394          fi
395
396             # GET AND REMOVE CYCLE NUMBER, IF EXISTING, AND CHECK, IF FILE EXISTS
397          cycle=${text##*.}
398          if [[ $cycle = $text ]]
399          then
400                # filename contains no dot, i.e. no cycle number
401             if [[ "$text" = "$4" ]]
402             then
403                found=true
404                (( icycle = 0 ))
405             fi
406          else
407                # filename contains at least one dot
408                # find out if the string after the last dot is a number
409             if [[ $cycle =~ ^-?[0-9]+$ ]]
410             then
411                text=${text%.*}
412                if [[ "$text" = "$4" ]]
413                then
414                   found=true
415                   (( icycle = $((10#$cycle)) ))
416                fi
417             else
418                if [[ "$text" = "$4" ]]
419                then
420                   found=true
421                   (( icycle = 0 ))
422                fi
423             fi
424          fi
425
426          if (( icycle > maxcycle ))
427          then
428             (( 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
438          fi
439
440       else
441
442             # ABSOLUT-MODE ONLY REQUIRES TO CHECK IF FILE EXISTS
443          [[ $4 = $line ]]  &&  found=true
444       fi
445
446    done <$filelist
447 fi
448
449 if [[ $found = true ]]
450 then
451    if [[ $get = false ]]
452    then
453       if [[ $absolut = false ]]
454       then
455          if [[ $append = false ]]
456          then
457             (( maxcycle = maxcycle + 1 ))
458
459                # TRY TO USE FIXED CYCLE NUMBER, IF GIVEN AS OPTION
460             if [[ "$usecycle" != "" ]]
461             then
462                if (( usecycle >= maxcycle ))
463                then
464                   (( maxcycle = usecycle ))
465                else
466                    printf "  >>> Unfied cycle number cannot be used\n"
467                fi
468             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
478       else
479          if [[ $overwrite = false ]]
480          then
481             printf "  +++ file \"$3/$4\" \n"
482             printf "      already exists on destination host (use -o, if necessary) \n"
483             locat=file; exit
484          fi
485       fi
486    else
487       if [[ $absolut = false ]]
488       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
503       else
504          cyclestring=""
505       fi
506    fi
507
508 else
509
510    if [[ "$usecycle" != "" ]]
511    then
512       (( maxcycle = usecycle ))
513       cyclestring=`printf ".%03d" $usecycle`
514    else
515       cyclestring=""
516    fi
517
518       # EXIT, IF FILE SHALL BE GET FROM THE TARGET HOST, BUT DOESN'T EXIST
519    if [[ $get = true ]]
520    then
521       printf " +++ file \"$3/$4\" \n"
522       printf "     does not exist on destination host (\"$1\") \n"
523       locat=remotefile; exit
524    fi
525 fi
526
527
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 
537    # IF NAME-OPTION (-n) IS CHOSEN, ONLY DETERMINE THE LOCAL FILENAME ON THE
538    # TARGET HOST AND EXIT THE SCRIPT
539 if [[ $print_local_filename = true ]]
540 then
541    printf "$4$cyclestring\n"
542    rm -r $filelist
543    exit
544 fi
545
546
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)
549 if [[ "$5" != ""  &&  $get = false ]]
550 then
551    cyclestring=${cyclestring}.$5
552 fi
553
554
555    # IN CASE OF FOLDER TRANSER TO THE TARGET HOST, CHECK IF ARGUMENT $3 REALLY
556    # REFERS TO A FOLDER ON THE TARGET HOST
557 if [[ $catalog_copy = true  &&  $get = true ]]
558 then
559
560    rm -rf $filelist
561    ssh $SSH_PORTOPT $1 -l $remote_user "cd $3" > $filelist
562
563    if [[ $? != 0 ]]
564    then
565       locat=ssh_failed_3; exit
566    fi
567
568    if [[ $(cat $filelist | grep -c "Not a directory") != 0 ]]
569    then
570       printf " +++ \"$3\" on destination host is not a directory \n"
571       locat=directory; exit
572    fi
573
574 fi
575
576
577    # IN CASE OF FOLDER TRANSFER FROM THE TARGET HOST TO THE LOCAL HOST,
578    # CREATE THE RESPECTIVE FOLDER ON THE LOCAL HOST
579 if [[ $catalog_copy = true ]]
580 then
581    if [[ $get = true ]]
582    then
583       mkdir $2
584    fi
585 fi
586
587
588 catalog_name=$3
589 [[ "$catalog_name" != "" ]]  &&  catalog_name=${catalog_name}/
590
591
592    # COPY FILE/FOLDER VIA SCP
593 if [[ $get = false ]]
594 then
595    if [[ $make_catalog != force ]]
596    then
597       if [[ $append = false ]]
598       then
599
600          if [[ $catalog_copy = false ]]
601          then
602             scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
603          else
604             scp $PORTOPT -p -r $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
605          fi
606          scp_status=$?
607
608          if [[ $scp_status != 0 ]]
609          then
610                # CHECK, IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
611             local_size=`ls -al  $2`
612             local_size=`echo $local_size | cut -d" " -f5`
613
614             remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al $catalog_name$4$cyclestring"`
615             remote_size=`echo $remote_size | cut -d" " -f5`
616
617             if [[ "$remote_size" != "$local_size" ]]
618             then
619                echo " +++ scp failed on host \"$local_host\" with exit $scp_status"
620                echo "     local size = \"$local_size\"  remote size = \"$remote_size\" "
621                date
622                locat=scp_failed; exit
623             fi
624          fi
625
626       else
627
628          scp $PORTOPT -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
629
630          if [[ $? != 0 ]]
631          then
632                # CHECK, OB IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
633             local_size=`ls -al  $2`
634             local_size=`echo $local_size | cut -d" " -f5`
635
636             remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
637             remote_size=`echo $remote_size | cut -d" " -f5`
638
639             if [[ "$remote_size" != "$local_size" ]]
640             then
641                echo " +++ scp failed on host \"$local_host\" with exit $scp_status"
642                echo "     local size = \"$local_size\"  remote size = \"$remote_size\" "
643                date
644                locat=scp_for_append_failed; exit
645             fi
646          fi
647
648          rm  $filelist
649
650          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
651
652          if [[ $? != 0 ]]
653          then
654             if [[ ! -f $filelist ]]
655             then
656                locat=append_via_ssh_failed; exit
657             else
658                if [[ $(grep -c "*** append complete" $filelist) = 0 ]]
659                then
660                   locat=append_via_ssh_failed; exit
661                fi
662             fi
663          fi
664       fi
665
666    else
667
668       ssh $SSH_PORTOPT $1 -l $remote_user "mkdir -p $3"
669
670       if [[ $? != 0 ]]
671       then
672          locat=ssh_failed_4; exit
673       fi
674
675       scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$cyclestring  > /dev/null
676
677       if [[ $? != 0 ]]
678       then
679          locat=scp_failed; exit
680       fi
681    fi
682
683 else
684
685    if [[ $catalog_copy = false ]]
686    then
687       if [[ $quote_wait = true ]]
688       then
689
690          printf " +++ quote wait not realized with BATCH_SCP"
691          locat=unavailable_feature; exit
692
693       else
694
695          scp $PORTOPT -p $remote_user@$1:$catalog_name$4$cyclestring $2  > /dev/null
696
697          if [[ $? != 0 ]]
698          then
699             locat=scp_failed; exit
700          fi
701
702       fi
703
704    else
705
706       printf " +++ get of whole cataloges not realized with BATCH_SCP so far"
707       locat=unavailable_feature; exit
708
709    fi
710
711 fi
712
713
714
715    # DELETE TRANSFERED FILE ON THE LOCAL HOST
716 if [[ $delete = true  &&  $get = false ]]
717 then
718    rm -rf  $2
719 fi
720
721
722
723    # FINAL MESSAGES
724 if [[ $silent = false ]]
725 then
726    if (( maxcycle == 0 ))
727    then
728       if [[ $append = false ]]
729       then
730          printf "  >>> transfer successful \n"
731       else
732          printf "  >>> file was appended \n"
733       fi
734    else
735       printf "  >>> transfer successful \n"
736       if [[ $append = false ]]
737       then
738          if [[ $catalog_copy = false ]]
739          then
740             printf "      new file has cycle number .%03d \n" $maxcycle
741          else
742             printf "      new catalog has cycle number .%03d \n" $maxcycle
743          fi
744       else
745          printf "      append to cycle number .%03d \n" $maxcycle
746       fi
747    fi
748 fi
749
750 rm -rf  $filelist  $errfile
Note: See TracBrowser for help on using the repository browser.