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:
... 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.
Canadore College, Network Analyst
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.