Re: Scripting and Attach

Alexander Lukyanov <[email protected]> Sun, 10 Dec 2017 18:22:56 +0000
Newsgroups gmane.network.lftp.user
Message-ID <CANnoEwr-N2NueRqc7TP=De+OeZU8xh0tzHycROiXE6BeQrEu_A@mail.gmail.com>
--===============4706717759247061418==
Content-Type: multipart/alternative; boundary="089e082c85006657cd056000820d"

--089e082c85006657cd056000820d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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).

=D0=B2=D1=81, 10 =D0=B4=D0=B5=D0=BA. 2017, 12:00 Tim <hayesti86+lftp@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
> [email protected]
> http://univ.uniyar.ac.ru/mailman/listinfo/lftp
>

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

<p dir=3D"ltr">I think you have to feed the commands to lftp from the stdin=
. Like this:<br>
=C2=A0=C2=A0=C2=A0=C2=A0 echo queue get ... | lftp -c &quot;attach 1234&quo=
t;</p>
<p dir=3D"ltr">The commands after attach command in your script are execute=
d after the attach is finished (detached).</p>
<br><div class=3D"gmail_quote"><div dir=3D"ltr">=D0=B2=D1=81, 10 =D0=B4=D0=
=B5=D0=BA. 2017, 12:00 Tim &lt;<a href=3D"mailto:hayesti86%[email protected]=
">[email protected]</a>&gt;:<br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><span style=3D"font-size:12.8px">I&#39;m trying to automa=
te LFTP activity from a Python script. I&#39;m would like to achieve a beha=
viour whereby if there is a background LFTP process then attach to it and a=
ppend 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"fo=
nt-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.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"fo=
nt-size:12.8px">I receive a not connected error and the file isn&#39;t queu=
ed</div><div style=3D"font-size:12.8px"><br></div><div style=3D"font-size:1=
2.8px">If I attach to an existing process, open a connection and queue file=
s:</div><div style=3D"font-size:12.8px"><div>=C2=A0 =C2=A0 attach 1234</div=
><div>=C2=A0 =C2=A0=C2=A0open sftp://<a href=3D"http://releases.ubuntu.com/=
" target=3D"_blank">releases.ubuntu.com/</a>=C2=A0-u ubuntu,ubuntu</div><di=
v>=C2=A0 =C2=A0=C2=A0queue get &quot;ubuntu-16.04.3-desktop-amd64.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 process. The outp=
ut 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] Detaching from =
the terminal to complete transfers...</div><div>=C2=A0 =C2=A0 [5678] 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>
_______________________________________________<br>
lftp mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a=
><br>
<a href=3D"http://univ.uniyar.ac.ru/mailman/listinfo/lftp" rel=3D"noreferre=
r" target=3D"_blank">http://univ.uniyar.ac.ru/mailman/listinfo/lftp</a><br>
</blockquote></div>

--089e082c85006657cd056000820d--

--===============4706717759247061418==
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

--===============4706717759247061418==--