Scripting and Attach

Tim <[email protected]> Sun, 10 Dec 2017 09:00:25 +0000
Newsgroups gmane.network.lftp.user
Message-ID <CAG4hJevHt5s9BLFc-3H0G8qWSbj72bUYtKox2Wd1-+s+xRAY9A@mail.gmail.com>
--===============1782365644972321039==
Content-Type: multipart/alternative; boundary="94eb2c1ce1940eda30055ff8a63b"

--94eb2c1ce1940eda30055ff8a63b
Content-Type: text/plain; charset="UTF-8"

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.

--94eb2c1ce1940eda30055ff8a63b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-size:12.8px">I&#39;m trying to automat=
e LFTP activity from a Python script. I&#39;m would like to achieve a behav=
iour whereby if there is a background LFTP process then attach to it and ap=
pend to its existing queue. I&#39;m invoking LFTP with -f and feeding it a =
string of commands generated from my Python script.</span><div style=3D"fon=
t-size:12.8px"><br></div><div style=3D"font-size:12.8px">I&#39;m using=C2=
=A0LFTP version 4.6.0</div><div style=3D"font-size:12.8px"><br></div><div s=
tyle=3D"font-size:12.8px">If I attach to an existing process and queue file=
s:</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0=C2=A0attach 1234</div=
><div style=3D"font-size:12.8px">=C2=A0 =C2=A0=C2=A0queue get &quot;ubuntu-=
16.04.3-desktop-amd64.<wbr>iso&quot;</div><div style=3D"font-size:12.8px">=
=C2=A0 =C2=A0 bye</div><div style=3D"font-size:12.8px"><br></div><div style=
=3D"font-size:12.8px">I receive a not connected error and the file isn&#39;=
t queued</div><div style=3D"font-size:12.8px"><br></div><div style=3D"font-=
size:12.8px">If I attach to an existing process, open a connection and queu=
e files:</div><div style=3D"font-size:12.8px"><div>=C2=A0 =C2=A0 attach 123=
4</div><div>=C2=A0 =C2=A0=C2=A0open sftp://<a href=3D"http://releases.ubunt=
u.com/" target=3D"_blank">releases.ubuntu.com/</a>=C2=A0-u ubuntu,ubuntu</d=
iv><div>=C2=A0 =C2=A0=C2=A0queue get &quot;ubuntu-16.04.3-desktop-amd64.<wb=
r>iso&quot;</div><div>=C2=A0 =C2=A0 bye</div></div><div style=3D"font-size:=
12.8px"><br></div><div style=3D"font-size:12.8px">It creates another proces=
s. The output resembles this:</div><div style=3D"font-size:12.8px"><div>=C2=
=A0 =C2=A0 [1234] Attached to terminal.</div><div>=C2=A0 =C2=A0 [1234] Deta=
ching from the terminal to complete transfers...</div><div>=C2=A0 =C2=A0 [5=
678] Moving to background to complete transfers...</div></div><div style=3D=
"font-size:12.8px"><br></div><div style=3D"font-size:12.8px">Is there a way=
 to achieve the desired behaviour, i.e. maximum of one LFTP process running=
? Thanks.</div></div>

--94eb2c1ce1940eda30055ff8a63b--

--===============1782365644972321039==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

--===============1782365644972321039==--