LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 01-07-2013, 08:49 AM   #1
bittus
Member
 
Registered: Aug 2006
Posts: 151

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:

Quote:
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:

Quote:
`...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
legolasthehansy
LQ Newbie
 
Registered: Dec 2006
Posts: 16

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
bittus
Member
 
Registered: Aug 2006
Posts: 151

Original Poster
Rep: Reputation: 15
@legolasthehansy

Thank you for the help. Appreciate . . .

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

Rep: Reputation: Disabled
Unhappy

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
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 93

Rep: Reputation: 19
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

Quote:
#!/bin/bash
x=$(lftp pi:password@192.168.1.50 -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@192.168.1.50 -e "get /media/250_gb/Sharing/Filme/Star\ wars\ saga/6-Return.of.the.Jedi.mp4; bye" & ## here comes the download backgrounded
(
while [ 1 ]
do
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
fi
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:	22
Size:	143.8 KB
ID:	18161  

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


Reply

Tags
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
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


All times are GMT -5. The time now is 09:50 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration