Discussion:
lftp "attach" cmd in a shell script
Stéphane Durand
2013-07-15 08:02:55 UTC
Permalink
Hi all,

I am trying to script a command in which if an instance of lftp is already running, then I would simply like to add some items in the queue, therefore I would need to execute the command attach passing as argument the PID. This works fine in manual operations, but I would like to automate it within a shell script and pass as arguments the rest of the command once attached to the proper session. i,e as following

lftp -e "attach 24164;queue mirror -c ... ...;bye"

The problem is that it returns the following

[24164] Attached to terminal.
[24164] Detaching from the terminal to complete transfers...
mirror: Not connected
[634] Moving to background to complete transfers...

The mirror instruction not being added to the queue.

Any idea to solve this issue? Any help appreciated. Many thanks.

Mvh, Cordialement, Regards,
----------------------------------------
Stéphane Durand
***@gmail.com
Alexander V. Lukyanov
2013-07-15 13:00:40 UTC
Permalink
Post by Stéphane Durand
I am trying to script a command in which if an instance of lftp is already running, then I would simply like to add some items in the queue, therefore I would need to execute the command attach passing as argument the PID. This works fine in manual operations, but I would like to automate it within a shell script and pass as arguments the rest of the command once attached to the proper session. i,e as following
lftp -e "attach 24164;queue mirror -c ... ...;bye"
Unfortunately, it's not possible to do now. I have fixed it in github,
so you can try it this way:

echo "queue mirror -c ..." | lftp -c attach

Remember that it won't work in released versions yet.

--
Alexander.
Stéphane Durand
2013-07-15 13:06:08 UTC
Permalink
Hi!

Many thanks. Will try the github version and report on it.

Appreciate your help.

Mvh, Cordialement, Regards,
----------------------------------------
Stéphane Durand
Post by Alexander V. Lukyanov
Post by Stéphane Durand
I am trying to script a command in which if an instance of lftp is already running, then I would simply like to add some items in the queue, therefore I would need to execute the command attach passing as argument the PID. This works fine in manual operations, but I would like to automate it within a shell script and pass as arguments the rest of the command once attached to the proper session. i,e as following
lftp -e "attach 24164;queue mirror -c ... ...;bye"
Unfortunately, it's not possible to do now. I have fixed it in github,
echo "queue mirror -c ..." | lftp -c attach
Remember that it won't work in released versions yet.
--
Alexander.
Stéphane Durand
2013-07-16 20:28:40 UTC
Permalink
Hi,

Tried it, but it fails on configure when I run the configure file.

I tried with
$>./configure --with-openssl

$> ./configure --with-openssl=/opt/bin/openssl

$> ./configure --with-openssl --without-gnutls

$>./configure --with-openssl=/opt/bin/openssl --without-gnutls

An always get the following message

/configure: line 36323: syntax error near unexpected token `LIBGNUTLS,'
./configure: line 36323: ` PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 1.0.0,'

Any ideas?

Thanks
/S
Post by Alexander V. Lukyanov
Post by Stéphane Durand
I am trying to script a command in which if an instance of lftp is already running, then I would simply like to add some items in the queue, therefore I would need to execute the command attach passing as argument the PID. This works fine in manual operations, but I would like to automate it within a shell script and pass as arguments the rest of the command once attached to the proper session. i,e as following
lftp -e "attach 24164;queue mirror -c ... ...;bye"
Unfortunately, it's not possible to do now. I have fixed it in github,
echo "queue mirror -c ..." | lftp -c attach
Remember that it won't work in released versions yet.
--
Alexander.
Alexander V. Lukyanov
2013-07-17 13:02:03 UTC
Permalink
Post by Stéphane Durand
Tried it, but it fails on configure when I run the configure file.
Did you use autogen.sh ?
--
Alexander.
Stéphane Durand
2013-07-17 13:06:03 UTC
Permalink
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.

I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.

Thanks again for your help.
Post by Alexander V. Lukyanov
Post by Stéphane Durand
Tried it, but it fails on configure when I run the configure file.
Did you use autogen.sh ?
--
Alexander.
Alexander V. Lukyanov
2013-07-17 13:22:32 UTC
Permalink
Post by Stéphane Durand
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.
I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.
Do you have the file /usr/share/aclocal/pkg.m4 and pkgconfig package installed?
--
Alexander.
Stéphane Durand
2013-07-17 13:26:30 UTC
Permalink
Hi, thanks again for your feedback.

I will check that and report. When you mean pkgconfig, you mean this one right? http://linux.die.net/man/1/pkg-config
Post by Alexander V. Lukyanov
Post by Stéphane Durand
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.
I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.
Do you have the file /usr/share/aclocal/pkg.m4 and pkgconfig package installed?
--
Alexander.
Stéphane Durand
2013-07-17 17:25:00 UTC
Permalink
Hi,

Finally got to test it. My system is as follow

$> ll /usr/share/aclocal/pkg.m4
-rw-r--r-- 1 root root 2027 2010-05-14 10:33 /usr/share/aclocal/pkg.m4

$> pkg-config --version
0.15.0

and I still get the problem... any ideas? Is there a specific version of pkgconfig required?

Thanks!
/S
Post by Alexander V. Lukyanov
Post by Stéphane Durand
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.
I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.
Do you have the file /usr/share/aclocal/pkg.m4 and pkgconfig package installed?
--
Alexander.
Stéphane Durand
2013-07-17 19:39:47 UTC
Permalink
ok. I've installed pkgconfig v0.28 and now it seems to go a little further. but I get a new error

configure: creating ./config.status
config.status: creating Makefile
config.status: error: cannot find input file: `src/Makefile.in'

When I check, there is no Makefile.in in the src dir on my git clone and not on the git repo either. any idea where I can find it?

thx!
Post by Alexander V. Lukyanov
Post by Stéphane Durand
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.
I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.
Do you have the file /usr/share/aclocal/pkg.m4 and pkgconfig package installed?
--
Alexander.
Stéphane Durand
2013-07-17 20:19:00 UTC
Permalink
ok. I guess I understand why it is not there... seems to be generated by autogen.sh.

If I fake a src/Makefile.in, it does complain about lib/Makefile.in and I guess those are quite key to generate the libs that the exec will use after...

Anyway, those are my findings, any idea are welcome, I will continue searching and post if I find anything.

Cheers!
/S
Post by Stéphane Durand
ok. I've installed pkgconfig v0.28 and now it seems to go a little further. but I get a new error
configure: creating ./config.status
config.status: creating Makefile
config.status: error: cannot find input file: `src/Makefile.in'
When I check, there is no Makefile.in in the src dir on my git clone and not on the git repo either. any idea where I can find it?
thx!
Post by Alexander V. Lukyanov
Post by Stéphane Durand
yes, sorry I forgot to indicate that. I used autogen with the same arguments as described in my previous mail.
I also tried to install both gnutls and gnutls-devel pkg for my distro, but same result.
Do you have the file /usr/share/aclocal/pkg.m4 and pkgconfig package installed?
--
Alexander.
Alexander V. Lukyanov
2013-07-18 04:43:15 UTC
Permalink
I have placed current snapshot at
ftp://ftp.yar.ru/lftp/devel/lftp-pre4.4.9-20130718.tar.gz
Please test.
--
Alexander.
Stéphane Durand
2013-07-18 06:13:26 UTC
Permalink
Configure passed
now compiling

will keep posted.

Thank you very very much again for all your help.

Still wondering why I could not get the last git to compile...
Post by Alexander V. Lukyanov
I have placed current snapshot at
ftp://ftp.yar.ru/lftp/devel/lftp-pre4.4.9-20130718.tar.gz
Please test.
--
Alexander.
Stéphane Durand
2013-07-20 15:56:54 UTC
Permalink
Compiled. Tested in live conditions and running as it should! :)

Great work! Can't thank you enough for your help.
Post by Alexander V. Lukyanov
I have placed current snapshot at
ftp://ftp.yar.ru/lftp/devel/lftp-pre4.4.9-20130718.tar.gz
Please test.
--
Alexander.
one2
2013-08-11 08:49:19 UTC
Permalink
Hi,

I could use this feature too, this way I would not need to have multiple
slots open on the ftp server, when another mirrors starts.

Thanks.

o2

Loading...