Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-07-2013, 08:49 AM   #1
Registered: Aug 2006
Posts: 153

Rep: Reputation: 15
lftp with progress bar in a script

I would like to see the progress of lftp download while running in a script.

Currently I am using the following in my script:

lftp -c 'pget -n 100 http://xx:xx:xx:xx/cloud_2012/cloud_config.tar '
But this does not display the progress of download while executing thru the script.

If i execute the command manually, I'm able to see the progress as below:

`...cloud_config.tar', got 35256440 of 35614720 (98%) 726.2K/s eta:28s
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooo..oooo.
I would like to see the same output while executing the command thru script. Appreciate any sort of help.

Thank you.
Old 01-07-2013, 09:33 AM   #2
LQ Newbie
Registered: Dec 2006
Posts: 19

Rep: Reputation: 1
Can you try adding 2>&1 to your lftp script? This should redirect the output to the console but sure might mess up while you are in the middle of something.. You can redirect to a file instead.
Old 01-08-2013, 02:37 AM   #3
Registered: Aug 2006
Posts: 153

Original Poster
Rep: Reputation: 15

Thank you for the help. Appreciate . . .

Sorry to say that it did not work
Old 04-15-2015, 01:17 AM   #4
LQ Newbie
Registered: Apr 2015
Posts: 4

Rep: Reputation: Disabled

Sorry for the necrobump but I'm having the same problem. Did anyone came up with a solution for viewing the progress of current job when you queue several jobs?
Old 04-18-2015, 04:13 AM   #5
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 102

Rep: Reputation: 30
you could get the file size as variable 1 , partial download size as variable2 , pipe echo ratio between final and actual using zenity or yad , thus progress bar

something like

x=$(lftp pi:password@ -e "du /media/250_gb/Sharing/Filme/Star\ wars\ saga/6-Return.of.the.Jedi.mp4; bye" );x=$(echo $x | cut -d ' ' -f 1) # here comes the final file size
lftp pi:password@ -e "get /media/250_gb/Sharing/Filme/Star\ wars\ saga/6-Return.of.the.Jedi.mp4; bye" & ## here comes the download backgrounded
while [ 1 ]
sleep 0.1 # sleep time not to overload CPU
y=$(du -lc 6-Return.of.the.Jedi.mp4 | sed '1!d' | sed 's/\t.*//g') # here comes the actual download size
let procentaj=(y*100)/x
echo $procentaj
if [ "$y" == "$x" ] ;then exit 0
done )| zenity --width=400 --height=100 --progress --title="lftp download" --text="Please wait ...downloading $x)" --percentage=0 --auto-close ;
replace pi:password with your conf , can use variables in lfpt , can do more bash scripting just using imagination
you could add notify functions , and many more , depending by gtk 2 or 3,
Attached Thumbnails
Click image for larger version

Name:	Screenshot.jpg
Views:	181
Size:	143.8 KB
ID:	18161  

Last edited by yo8rxp; 04-18-2015 at 02:42 PM.



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
mv with progress bar gbowden Linux - General 28 08-14-2013 04:42 AM
rsync bash script w/ progress bar? babalot Programming 4 04-28-2009 11:09 AM
Shell Script Progress bar rooch84 Linux - Software 8 09-03-2005 04:55 PM
PROGRESS BAR with shell script murugesan Linux - Software 5 12-13-2004 09:03 AM
Progress Bar zael Programming 3 10-01-2003 12:20 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:03 PM.

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