This blog is NOFOLLOW Free!
Print This Post Print This Post

The Linux Chronicles – Downloader Upate


This will be a brief one today.  This is an update and error correction post regarding download managers.  I’ve spent a couple of days with both Gwget and Downloader for X so I know more about them.

Gwget frankly isn’t ready for prime time.  It downloads but that’s about it.  On my machine it doesn’t recover from a hang-up  – one has to stop and restart the download plus it has no throttling or scheduling facilities.  No reason to try to use it with Downloader for X (DfX) available.

Contrary to my previous statement, DfX does have a scheduler and a crude throttle.  It can also hang up after a fashion.  Finally, it will monitor the clipboard and grab stuff otherwise headed for the browser.  In other words, it has most of the functionality of FDM but not quite as elegant.

The main problem with the throttle is that one cannot set the throttle speeds.  The slowest speed is 1kbps which is decent, though I usually throttle to 2k.  That leaves enough bandwidth to browse at a decent rate while still accomplishing the download in the background.  The big problem is the next click.  That’s 10x as fast which is far faster than dial-up.  I’d love for the second click to be settable so I could have it at about 4kbps.  That gives the bulk of the bandwidth to the download manager while leaving enough to browse a little and for the mail to flow.  Actually, Linux shares bandwidth so much better than windows that this might not be necessary.  More experience is needed.

For hanging up, it has the ability to exit after a specified number of minutes of idle time.  It also has the ability to run a program on exit.  I could, of course, run shutdown to shut down the machine.  I’d have to figure out privileges and such.

Simply hanging up is a little more complicated.  I can run poff which shuts down the ppp daemon and hangs up the modem.  Problem is, if I’ve dialed in using one of the dial managers that automatically reconnects upon disconnect then the manager will promptly dial back in!  I guess that I’ll have to write a script that looks at how pppd was started and act accordingly.  A real guru moment but I’ll post the script here so that you won’t have to figure it out.


Or “repeat ppp”.  This is a little script that I whipped out last night to address a problem peculiar to dial-up.  My “unlimited” (sic) ISP actually only allows 300 hours a month so I can’t just leave the line up all night or when I’m gone after a download finishes.  At the same time, they gratuitously hang up the line every 4 hours just to be annoying.  I can turn the latter part to my benefit, however.  I can use it to time my connection with a granularity of 4 hours.

To do that, what I need is a dialup manager that will connect for a specified time and then hang up.  A simple way to do that is to disable auto-reconnect and then invoke the dialup manager whatever number of times required to get the hours.  If I need 8 hours, I invoke it twice.  12 hours, 3 times.

A command dialer that is included on the distro is called WVdial (I mistakendly called it WVnetwork in my first post in this series.)  It comes with a command line configuration program called wvdialconf that takes your ISP info and writes an initial /etc/wvdial.conf and /etc/chatscripts/<isp-chat> where isp-chat is a file containing data specific to your isp.  It’s a lot easier than it sounds.

To get started, open a terminal window and start wvdiaconf.  Answer all the questions.  Then execute these commands

$ cd /etc
$ sudo gedit wvdial.conf

Add this line

Auto Reconnect = no

so that the entry looks like this

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 115200
New PPPD = yes
Auto Reconnect = no
Modem = /dev/ttyS0
ISDN = 0
Phone = 5454053
Username = your_isp_login_name
Password = your_login_password

Note that your file may be different because it is written by wvdialconf.  Adding the “Auto Reconnect = no” is the only thing you have to do.

To initiate a connection, simply type

$ wvdial

Unlike winders and the Linux graphical dial managers, this one lets you watch what is happening.  Handy for troubleshooting a connection.  It’ll connect and start pppd and then stop.  To hang up, either press control-C or run poff. 

All that is preliminary to my little repee script which is:

# script to run the dialer a specified number of times
        echo "Usage: $0 <number of times>"
    exit 1;

test  "$1" || usage

for ((i=0;i<$2;i++)); do

    /usr/bin/wvdial $1


To use this script to allocate 3 cycles, simply type

$ repee 3

It runs wvdial and then sits there until wvdial exits.  Wvdial exits when the line hangs up.  The script promptly loops around and fires off wvdial again. It repeats this action for the number of times specified on the command line.

For example, I found a large ebook last night that required 9 hours to download according to DfX.  I fired off the following command:

$ repee 3

Which allocated 3 4 hour chunks of time or 12 total hours.  That was about 7pm.  When I got up at 9am, I had the file and the modem had hung up.

Simple, huh? :-)


Posted by neonjohn on January 28th, 2009 under Computing

Leave a Comment

Comments links could be nofollow free.


  • Meta