Changing lftp log location in the middle of transfer

274 views Asked by At

I am trying to tranfer multiple file using lftp 4.4.8 on a centos 7 machine, on a daily basis.

For the purpose of monitoring this workflow, I would like to log transferred file into 2 groups (first and second). So I change the log file address in the middle of transfer script, using set xfer:logfile mysecond.txt.

Here is the script:

#!/bin/bash

lftp $HOST -u $USER,$PASSWORD <<EOF

set xfer:log true
set xfer:log-file myfirst.log

lcd /local/path/first

cd /remote/path/first

put file-first.txt
put file-first2.txt

lcd /local/path/second
set xfer:log-file mysecond.log

cd /remote/path/second

put file-second.txt
put file-second2.txt

bye
EOF

But the result is not as expected. All transferred file (including file-second.txt and file-second2.txt) are logged into the first log file (myfirst.log). Looks like lftp does not recognize changing the log file in the following line:

set xfer:log-file mysecond.log

Am I missing something? How can I achieve what I intend?

Many thanks.

0

There are 0 answers