I think you have to feed the commands to lftp from the stdin. Like this:
     echo queue get ... | lftp -c "attach 1234"

The commands after attach command in your script are executed after the
attach is finished (detached).

вс, 10 дек. 2017, 12:00 Tim <hayesti86+l...@gmail.com>:

> I'm trying to automate LFTP activity from a Python script. I'm would like
> to achieve a behaviour whereby if there is a background LFTP process then
> attach to it and append to its existing queue. I'm invoking LFTP with -f
> and feeding it a string of commands generated from my Python script.
>
> I'm using LFTP version 4.6.0
>
> If I attach to an existing process and queue files:
>     attach 1234
>     queue get "ubuntu-16.04.3-desktop-amd64.iso"
>     bye
>
> I receive a not connected error and the file isn't queued
>
> If I attach to an existing process, open a connection and queue files:
>     attach 1234
>     open sftp://releases.ubuntu.com/ -u ubuntu,ubuntu
>     queue get "ubuntu-16.04.3-desktop-amd64.iso"
>     bye
>
> It creates another process. The output resembles this:
>     [1234] Attached to terminal.
>     [1234] Detaching from the terminal to complete transfers...
>     [5678] Moving to background to complete transfers...
>
> Is there a way to achieve the desired behaviour, i.e. maximum of one LFTP
> process running? Thanks.
> _______________________________________________
> lftp mailing list
> lftp@uniyar.ac.ru
> http://univ.uniyar.ac.ru/mailman/listinfo/lftp
>
_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

Reply via email to