"The Linux Gazette...making Linux just a little more fun!"

(?) The Answer Guy (!)

By James T. Dennis, tag@lists.linuxgazette.net
Starshine Technical Services, http://www.starshine.org/

(?) Letting Those Transfers Run Unattended

From Terry Singleton on Wed, 02 Dec 1998

(?) While at home, dialed into work with my 56Kb modem, I sometimes run across very large interesting looking applications. I often wish that there were a way for me to telnet to my Linux box at work and start the download. When I got to work the next day the download would have hopefully completed.

Question: Is there a way for me to start my download remotely, disconnect from the Linux server and have the server continue to download the file(s)??

(!) Yes. The most obvious is to use 'screen' - this will let you start interactive processes over a dialup or telnet connect (or within an xterm, on a VC), then you can "multiplex" multiple interactive programs and you can "detach" the whole session from your terminal/connection.
Later, when you reconnect you can re-attach to your 'screen' session using the command:
screen -r
... assuming that you only have one of them going. If you've started multiple 'screen' sessions you can select the one to which you want to re-attach using additional command switches (read the man page for that).
I routinely use 'screen' (I'm using from a virtual console right now). If I leave this session like this and connect from my terminal in the living from (to watch a little CNN or "Law & Order" as I work) I just use the command:
screen -r -d
... to simultaneously detach and reattach my screen session --- to effectively "yank it over to my terminal."
Another advantage of using 'screen' is that my session is preserved if I get disconnected. (There's an "auto-detach" feature). So, you can leave the same session saving state in up to ten programs for weeks, even months at a time. (I have three copies of xemacs, a copy of lynx and a couple of shell prompts to the local and some of the other hosts on my net open as I type this).
I do try to force myself to drop out of my screen session at least once a month.
If you're using FTP to get these files you can also use the 'ncftp' command line features, including a "re-dial" which will keep trying to get to that busy FTP site until it gets your files. There's also a program called 'lftp' that is a "command line driven, script friendly" FTP client.
Another approach would be to use 'expect' and/or Kermit scripts which you start at the remote and run "asynchronously" (in the background by slapping an '&' ampersand on the end of the command or by hitting [Ctrl]+[Z] to "suspend" the job and issuing the 'bg' command to restart it as though you'd put the '&' on it to begin with.
Note that this "job control" feature (the [Ctrl]+[Z] and 'bg' stuff) only works with non-interactive programs. Interactive programs are likely to stop with a "waiting on terminal input" message. 'screen' and any properly written 'expect' script will cope with those because they set up a Unix domain socket as a sort of "virtual" terminal to control the interactive software.

(?) Regards,
Terry Singleton
Canadore College, Network Analyst

(?) Letting Those Transfers Run Unattended

From Terry Singleton on Fri, 25 Dec 1998

(?) Where do I find screen I searched my system and www.freshmeat.net but could not find the app you mentioned. I am running RedHat 5.1 and I believe installed almost everything.


(!) That's odd. When I use freshmeat's "Quickfinder" it's the first entry that shows up. (Maybe the older version wasn't listed. A new version was just released recently --- after you sent me this message I think).
Here's the Freshmeat "AppIndex" URL:
( freshmeat ) - ( details of "screen" )
... and here's the main web page:
screen - GNU Project - Free Software Foundation (FSF)
It's also easy to find at the Filewatcher site (http://filewatcher.org formerly lfw.linuxhq.com) and at the Linux Archive Search (http://las.ml.org).
However, Freshmeat returned the most recent version and the canonical web site, while the others showed dozens of links to older versions and other packages (with the string 'screen' in their names) and no information about the package. So Freshmeat's my first choice at this point.

Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 36 January 1999

[ Answer Guy Index ] a b c 1 2 3 4 5 6 7 9 10 11 12
15 16 18 19 20 21 22 23 24 25 26 27 28
29 31 32 33 34 35 36 37 38 39 40 41 42 44
45 46 47 48 49 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66
67 69 72 76 77 78 79 80 81 82 84 85 86 87 91 94 95 96 97 98

[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]