-   Linux - Server (
-   -   lftp with progress bar in a script (

bittus 01-07-2013 09:49 AM

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.

legolasthehansy 01-07-2013 10:33 AM

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.

bittus 01-08-2013 03:37 AM


Thank you for the help. Appreciate . . .

Sorry to say that it did not work :(

karloz34 04-15-2015 02:17 AM

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?

yo8rxp 04-18-2015 05:13 AM

1 Attachment(s)
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,

All times are GMT -5. The time now is 01:52 PM.