Results 1 to 6 of 6

Thread: wget and progress bar

  1. #1
    Join Date
    Apr 2009
    Beans
    30

    Post wget and progress bar

    Hello, I was wondering if you can help me with this. I have googled for an hour and found other people's solutions that just don't work.
    I need to get all files from a web directory and display a progress bar with zenity. Thus the code looks like this:

    Code:
    sudo wget -r --no-parent http://www.somewebsite/directory/ -P /somelocaldirectory/
    I have tried pipeing to zenity progress bar, but that only shows 0 and 100%. I have tried several versions with sed, but they dont work at all.

    Thanks

  2. #2

    Re: wget and progress bar

    why sudo?

    Code:
    function my_wget()
    {
    var3=%$(wget -r --no-parent http://www.somewebsite/directory/ -P /somelocaldirectory/)
    }
    
    touch /tmp/$$
    (  ( echo 1 ; while [ -f /tmp/$$ ] ; do sleep 1 ; done ; echo 100 ) |  zenity --progress --pulsate --auto-close --text="Counting Snapshots..."  --width=150 --title="" --undecorated --no-buttons) & my_wget
    rm /tmp/$$
    I ripped this snippet from a yad-driven program. Yad is the successor to
    zenity and has more options.

    Good Luck.

    Edit0:
    My code came from one, or more of these:
    A Little Hacking game with bash and Zenity - Ubuntu Forums
    A complete zenity dialog examples 1 » Linux by Examples
    Choose profile before launching GNOME Terminal emulator [bash] [shell] [gnome] [zenity]
    Bash Scripts using Zenity - FedoraForum.org
    Zenity Manual
    zenity site:unix.com/shell-programming-scripting/ - Google Search
    Ubuntu Forums - Threads Tagged with zenity
    Zenity and newlines in entry dialog. - Ubuntu Forums
    Zenity Progress Window
    YAD — A fork of zenity with more features « TechnoStripe
    zenity - Google Search
    "if [ "$?" -eq "0" ]" +zenity - Google Search
    zenity progress via function example Advanced Application Launchers With Zenity - TildeHash
    Last edited by Habitual; December 14th, 2012 at 10:33 PM. Reason: Added References
    Windows assumes the user is an idiot.
    Linux demands proof.

  3. #3
    Join Date
    Apr 2009
    Beans
    30

    Re: wget and progress bar

    Unfortunately, this code does not work , zenity gui does not appear at all. Thanks for the links, I will try with yad as well.

  4. #4

    Re: wget and progress bar

    Let me break down the process here, so maybe you'll understand what I presented:

    What needs to happen is a progress-meter needs to be shown while the "wget" action is performed. So you do a touch /tmp/$$ in the script and zenity is told
    "while [ -f /tmp/$$ ]" (while file exists) ; do the pulse action, then remove /tmp/$$ and continue with the
    written code.

    so when you say things like "doesn't work" or "other people's solutions that just don't work", it doesn't say to much.
    The meat-and-potatoes of the operation and should be tried out solo on your host is:
    Code:
    zenity --progress --pulsate --text="Progress-bar Check"  --width=150 --title="" --undecorated --no-buttons
    You never answered my question:
    Why sudo?

    Post your script using[code][/code] tags.
    Thank you,
    Windows assumes the user is an idiot.
    Linux demands proof.

  5. #5
    Join Date
    Apr 2009
    Beans
    30

    Re: wget and progress bar

    Ok, I will try this again.
    Sudo because I need to save files inside /etc/somefolder

  6. #6

    Re: wget and progress bar

    Sudo because I need to save files inside /etc/somefolder
    fair enough. Script should also include a "sudo -k" option to discard temporary sudo privs. It's good security practice to do so.

    Anyways: after reviewing http://linux.die.net/man/1/zenity the code that should work on your host may be:
    Code:
    zenity --progress --text="Progress-bar Check"  --width=150 --title=""
    yad has more options, as you can tell.
    Windows assumes the user is an idiot.
    Linux demands proof.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •