Hi Alexander,  

 >> mirror -v=1 works fine (i.e. prints name of every downloaded file) when run
 >> manually from command line, however it produces no output when lftp is run
 >> by cron job.
 >> 
 >> Sometimes I need to see lists of files downloaded by lftp's mirroring cron
 >> jobs and I wasn't able to achieve this so far.
 > 
 > I have no problem getting the output under cron from mirror command.
 > Please check that:
 >     1. lftp output is not redirected
 >     2. cron mails the output properly
 > 
 > BTW, which OS do you use?

Unfortunatleyy, I checked all of this. I'm using FreeBSD 5 and was sure this
is a common behaviour of lftp... 

I now modified my script_file as follows:

...
echo mirror start
mirror --delete --verbose=1 --continue  --parallel=3 --ignore-time . .
echo mirror end

When this is run from a terminal I see "mirror start", then list of files
that were transferred, and then "mirror end".

When run by cron, only "mirror start" and "mirror start" are mailed as the
output. (Yes, I removed some files before cron ran lftp and checked that
they re-appeared after so I know that lftp was actually downloading them.)

I tried adding "debug 100" to the script_file, however there is the same
problem here: debug output was mailed to me, but report statements like
"Transferring file", "Making symbolic link" are not shown.


Looking at source code I now think you are checking for this specifically in 
MirrorJob::va_Report

      pid_t p=tcgetpgrp(fileno(stdout));
      if(p!=-1 && p!=getpgrp())
         return;

I assume this means lftp won't print anything when there is no controlling
terminal and there is no controlling terminal for processess run by cron.

... I'm not really sure it's possible to make cron to allocate a terminal
for a process. Any ideas?

-- 
Michael

Reply via email to