There wasn't room in the magazine to include all of my original column. Here's the part we omitted, starting with the wget -r example:
You could start the next example over a dialup connection, then leave home to go shopping while the transfer completes and the modem shuts down. This example uses a script named ndown that's described in the next section, but you could do the same thing with a system utility or a script you hack.
$ wget -r ftp://bar.com/pub/; sleep 20; ndown
ndown ("network down"), shown in the previous example, can be simple to write but also very handy. Having a corresponding nup program to bring the network up lets you control it non-interactively: from a cron job, for instance. If your system has the /sbin/ifdown script to shut down a network interface, and PPP is configured so non-root users can control it, then ndown can be an alias that simply runs (for example) /sbin/ifdown ppp0.
nup.txt is a shell script that implements all of this and more. First, look through the script, be sure your system has /sbin/ifup and that you have access permission to run it. You may need to edit the script to fix pathnames and change features. Rename the file nup, make it executable (chmod 755 nup), then make a symbolic link to it named ndown (ln -s nup ndown).
If you use this script under the X Window System, it opens a small colored xmessage window while your network is up. It also makes a simple "lock file" that keeps you from accidentally bringing the modem up while it's already up. (You may want to hack the script to use more-sophisticated locking.)
Finally, you can use this setup from a GUI interface -- so you'll have modem control from a button as well as from the command line. The simple script nup-ndown.txt can be run from a button/launcher on your desktop. When the button is pressed, if the "lock file" doesn't exist, nup-ndown will run nup to bring up the modem; otherwise it runs ndown to shut down the modem. It's brainlessly simple, but it works well.
These scripts are from an old Red Hat 6.2 system, and they're a bit of a kludge. If you improve on them, please send your version to the email address below so I can share it.
Last change: 30 April 2003
Contact Jerry Peek