Guys
I'm trying to run lftp via cron and have noticed that it doesn't produce any
stdout when run without a terminal.
Everything else works and stderr gets produced and therefore emailed to me
via cron or written to a file.
However, I need a log that actually shows a working file transfer just in
case and I can't get lftp do to that via cron.
I can run this from a terminal
/usr/bin/lftp -e 'set net:max-retries 3; put {file};bye;' -u username,pass
sftp://url > ./xfer.log 2>&1
[stu...@vito transfer]$ cat ./xfer.log
5392377 bytes transferred in 60 seconds (88.4K/s)
[stu...@vito transfer]$
And it shows the transfer stats. However, if I run the same line via cron
xfer.log is just an empty file. If I don't redirect at all I should get
a mail sent to root which is how cron in RedHat works but nothing either
since there seems to be no stdout to begin with.
1. I get this on RHEL4 (lftp-3.0)and CENTOS5 (lftp-3.5.1). Does lftp
suppress stdout by design when not attachend to a terminal ?
2. I thought I could use the debug option but that seems broken. Out of all
debug levels only 9 appears to work. The others log nothing at all:
Level 1
/usr/bin/lftp -e 'debug -o ./xfer.log 1; set net:max-retries 3; put
{file};bye;' -u user,pass sftp://{url}
5392377 bytes transferred in 60 seconds
(88.4K/s)
+ '[' 0 -ne 0 ']'
+ exit 1
[stu...@vito transfer]$ cat ./xfer.log
[stu...@vito transfer]$
NOTHING
Level 8
+ /usr/bin/lftp -e 'debug -o xfer.log 8; set net:max-retries 3; put
{file};bye;' -u user,pass sftp://{url}
5392377 bytes transferred in 60 seconds
(88.4K/s)
+ '[' 0 -ne 0 ']'
+ exit 1
[stu...@vito transfer]$ cat ./xfer.log
[stu...@vito transfer]$
NOTHING
Level 9
+ /usr/bin/lftp -e 'debug -o ./xfer.log 9; set net:max-retries 3; put
{file};bye;' -u user,pass sftp://{url}
5392377 bytes transferred in 60 seconds
(88.4K/s)
+ '[' 0 -ne 0 ']'
+ exit 1
[stu...@vito transfer]$ cat ./xfer.log
---- Running connect program (ssh -a -x -s -l {user} -p 2022 {url} sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- got a packet, length=5, type=2(VERSION), id=0
---- protocol version set to 3
---> sending a packet, length=10, type=16(REALPATH), id=1
<--- got a packet, length=75, type=104(NAME), id=1
---- home set to /
---- path on wire is `/{file}'
---> sending a packet, length=34, type=3(OPEN), id=2
<--- got a packet, length=45, type=102(HANDLE), id=2
---- got file handle
2F707373746F72655F30382E32342E323030392F534345415F44524D2E6373762E677067
(36)
---> sending a packet, length=57, type=10(FSETSTAT), id=3
---> sending a packet, length=65593, type=6(WRITE), id=4
---> sending a packet, length=65593, type=6(WRITE), id=5
---> sending a packet, length=65593, type=6(WRITE), id=6
---> sending a packet, length=65593, type=6(WRITE), id=7
---> sending a packet, length=65593, type=6(WRITE), id=8
---> sending a packet, length=65593, type=6(WRITE), id=9
---> sending a packet, length=65593, type=6(WRITE), id=10
---> sending a packet, length=65593, type=6(WRITE), id=11
---> sending a packet, length=65593, type=6(WRITE), id=12
---> sending a packet, length=65593, type=6(WRITE), id=13
---> sending a packet, length=65593, type=6(WRITE), id=14
EVERYTING...way to much ! I was hoping for a 2 or 3. That'd solve my
problem.
Any ideas ?
--
stucky