LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-21-2011, 02:49 PM   #1
Danik
LQ Newbie
 
Registered: Jul 2005
Distribution: debian 7
Posts: 14

Rep: Reputation: 0
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?
 
Old 11-21-2011, 03:38 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
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.
 
Old 11-21-2011, 03:47 PM   #3
Danik
LQ Newbie
 
Registered: Jul 2005
Distribution: debian 7
Posts: 14

Original Poster
Rep: Reputation: 0
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

Last edited by Danik; 11-21-2011 at 03:59 PM.
 
Old 11-21-2011, 04:35 PM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
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.
 
Old 11-21-2011, 04:41 PM   #5
Danik
LQ Newbie
 
Registered: Jul 2005
Distribution: debian 7
Posts: 14

Original Poster
Rep: Reputation: 0
yes I have tried -e "mirror -c --verbose=0 /public_html .; exit"
with no luck
 
Old 05-01-2012, 05:11 PM   #6
jgustafson
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
I'm having the same issue

Did you ever find a solution to this?
 
  


Reply

Tags
cron, lftp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sadc output file creation behaviour when run from cron pukeko Red Hat 1 01-31-2011 05:22 AM
lftp to upload file pritisolanki Linux - Newbie 2 03-20-2009 07:59 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
lftp mirroring hangs cannot open file for reading archangel_617b Linux - Software 3 05-22-2008 11:03 AM
Cron output to a file Temujin_12 Linux - General 5 02-23-2005 01:52 PM


All times are GMT -5. The time now is 05:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration