LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   lftp cron and output to file (http://www.linuxquestions.org/questions/linux-server-73/lftp-cron-and-output-to-file-914761/)

Danik 11-21-2011 02:49 PM

lftp cron and output to file
 
Hi

trying to run lftp > out.txt and it works ok
but when I try to run in cron it does not print summary to out.txt

is there any possibility how I can make it?

colucix 11-21-2011 03:38 PM

It should works the same from crontab. Please, post the actual crontab entry. Have you any evidence that the lftp command actually runs from crontab? E.g. check the log files, check for any downloaded file and so on.

Danik 11-21-2011 03:47 PM

yes I am sure that script is working with crontab
and it is run the same way

in doc there is a line:
Code:

cmd:interactive (boolean)
              when true, lftp acts interactively, handles terminal signals and  outputs  some  extra
              messages. Default depends on stdin being a terminal.

http://lftp.yar.ru/lftp-man.html

as I understand whan it is run from crontab it is by default is in "set cmd:interactive off;"
i tried to make it on when running in crontab but it has no effect :(

the line I am trying to run the script from command line or by cron is like this:

Quote:

lftp -u 'user','pass' -e "mirror -c --verbose=0 /public_html ." mydomain.com > report.txt
p.s. I tried different variations to run the lftp the way lftp is called doesn't make any effect on my results that it doesn't save output to a file when called from cron

p.p.s. I just want to take final line from the lftp and sent it to email report

colucix 11-21-2011 04:35 PM

First, I would try to add the bye command after mirror:
Code:

-e "mirror -c --verbose=0 /public_html .; bye"
This will gracefully close the ftp session. Then you can try to use the full path for report.txt (a good habit in cron jobs) and redirect standard error as well.

Danik 11-21-2011 04:41 PM

yes I have tried -e "mirror -c --verbose=0 /public_html .; exit"
with no luck

jgustafson 05-01-2012 05:11 PM

I'm having the same issue
 
Did you ever find a solution to this?


All times are GMT -5. The time now is 03:18 AM.