Erick Perez
2006-Sep-20 14:41 UTC
[CentOS] How to reattach to a failed ssh session or process
Hi, is there a way to "reconnect" to a ssh session that was disconnected and left running processes in the linux server? I know that's the purpose of the screen command, but just to spread know-how, is that possible? Example: 3441 pts/0 S+ 0:00 nano /etc/httpd/conf/httpd.conf I remotely connect to a machine via ssh and started to edit apache conf and i did not used screen (me bad). The session timed out due to an internet glitch and I got disconnected. How can I reattach (speaking in screen terms) to that ssh session or gain control to the nano process (or any other)? Thanks, -- ------------------------------------------------------------ Erick Perez Panama Sistemas Integradores de Telefonia IP y Soluciones Para Centros de Datos Panama, Republica de Panama Cel Panama. +(507) 6694-4780 ------------------------------------------------------------
Steve Huff
2006-Sep-20 15:03 UTC
[CentOS] How to reattach to a failed ssh session or process
On Sep 20, 2006, at 10:41 AM, Erick Perez wrote:> Hi, is there a way to "reconnect" to a ssh session that was > disconnected and left running processes in the linux server? > > I know that's the purpose of the screen command, but just to spread > know-how, is that possible? > > Example: > 3441 pts/0 S+ 0:00 nano /etc/httpd/conf/httpd.conf > > I remotely connect to a machine via ssh and started to edit apache > conf and i did not used screen (me bad). The session timed out due to > an internet glitch and I got disconnected. > How can I reattach (speaking in screen terms) to that ssh session or > gain control to the nano process (or any other)?if you didn't start an instance of screen to begin with, you're out of luck; screen can't help you reattach to any arbitrary process, only to other instances of screen. does nano have a robust autosave/autorecover facility? if it does, just kill the nano process and start another (perhaps this time from within screen). if not, curse your bad luck and consider using vi next time, which can deal with this sort of problem. -steve -- If this were played upon a stage now, I could condemn it as an improbable fiction. - Fabian, Twelfth Night, III,v
Les Mikesell
2006-Sep-20 15:12 UTC
[CentOS] How to reattach to a failed ssh session or process
On Wed, 2006-09-20 at 09:41 -0500, Erick Perez wrote:> Hi, is there a way to "reconnect" to a ssh session that was > disconnected and left running processes in the linux server? > > I know that's the purpose of the screen command, but just to spread > know-how, is that possible? > > Example: > 3441 pts/0 S+ 0:00 nano /etc/httpd/conf/httpd.conf > > I remotely connect to a machine via ssh and started to edit apache > conf and i did not used screen (me bad). The session timed out due to > an internet glitch and I got disconnected. > How can I reattach (speaking in screen terms) to that ssh session or > gain control to the nano process (or any other)?You can't reconnect to a broken ssh connection, and in fact it should have killed all the processes you were running. However, some editors will save your work when terminated abnormally and let you recover in a different session. For example, if you used vi filename and were disconnected, you could recover later with vi -r filename I don't know anything about nano, though. -- Les Mikesell lesmikesell at gmail.com
Lamar Owen
2006-Sep-21 13:19 UTC
[CentOS] How to reattach to a failed ssh session or process
On Wednesday 20 September 2006 11:12, Les Mikesell wrote:> On Wed, 2006-09-20 at 09:41 -0500, Erick Perez wrote: > > Hi, is there a way to "reconnect" to a ssh session that was > > disconnected and left running processes in the linux server?> You can't reconnect to a broken ssh connection, and in fact it > should have killed all the processes you were running.Unfortunately, I have seen many instances where ssh sessions do like this; if one happens to be running a yum update in one, and yum is downloading packages (putting yum into its unkillable mode, which, in my opinion is such an annoying thing; there have been a number of times I'd start up an update, have it run for a while, then need to leave (taking my laptop with me, and thus disconnecting the session, which can cause its own problems) where I'd like to just simply CTRL-C yum and have it do the Right Thing; yum just cycles to the next mirror (at least the last time a couple of weeks ago it did this) when you hit CTRL-C OR when you send yum a SIGTERM)), then you can get some really wierd artifacts with unkillable but not running yum processes; I have seen a few where SIGKILL didn't do anything, and all because of a network glitch. -- Lamar Owen Director of Information Technology Pisgah Astronomical Research Institute 1 PARI Drive Rosman, NC 28772 (828)862-5554 www.pari.edu
Jordi Espasa Clofent
2006-Sep-21 14:20 UTC
[CentOS] How to reattach to a failed ssh session or process
Hi Erick: General but good info about screen use: http://www.linuxjournal.com/article/6340 I hope it will be useful for you. -- Jordi Espasa Clofent PGP id 0xC5ABA76A #http://pgp.mit.edu/ FSF Associate Member id 4281 #http://www.fsf.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20060921/fb7b1186/attachment-0002.sig>
Lamar Owen
2006-Sep-21 16:57 UTC
[CentOS] How to reattach to a failed ssh session or process
On Thursday 21 September 2006 09:29, Craig White wrote:> man screen > > screen creates a detachable sessionYes, I know. I've used it and dtach both. And it's usually the case that when I need to detach and reattach is typically when I've not run screen or dtach prior. Typically when I do run them, I haven't needed them; like any thing, it needs to become a habit, and I've just not made it a habit as yet. dtach is quite a bit simpler and smaller than screen; it doesn't, of course, do as much either. -- Lamar Owen Director of Information Technology Pisgah Astronomical Research Institute 1 PARI Drive Rosman, NC 28772 (828)862-5554 www.pari.edu