?
Solved

lost connection to linux server while running tar command

Posted on 2012-04-07
12
Medium Priority
?
1,012 Views
Last Modified: 2012-08-13
I'm stumbling my way through managing a linux server and have a question..

I have to connect via VPN and then use Putty to open a terminal to the server. I was running the tar command on a massive directory to create a backup, then the VPN connection was terminated and the putty connection went inactive. Which brings up three questions:
Did this interrupt the tar command?
If not, is there a way to verify it completed successfully or if it's still running?
And lastly, is there a better way to accomplish this task that isn't dependent on a persistent connection to the server?
0
Comment
Question by:musickmann
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 79

Expert Comment

by:arnold
ID: 37820379
Usually a break n the connection terminates all running commands in that shell unless screen is used or nohup precedes running of any commanding the background.
While the tar process may have been interrupted, the space used for the partial file wll not be freed.
0
 
LVL 8

Expert Comment

by:eager
ID: 37821382
I generally connect with remote systems using VNC.  This gives me an X display, just like running on a local system.  But I can disconnect (or have the connection fail) without the X session and remote login disappearing.   When I reconnect, the session is still live and I can check on status.   Take a look at http://tightvnc.com.
0
 
LVL 2

Author Comment

by:musickmann
ID: 37821945
Hmmm. I haven't considered using VNC. I inherited the servers from the previous person who was managing them, and so far nothing has seemed to be standard in their configuration.
It's a CentOS system, would that have a X display installed automatically, or will I have to install something else?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 79

Accepted Solution

by:
arnold earned 2000 total points
ID: 37821967
You can run rpm -qa | grep -i xorg
If you are comfortable with text/terminal access, install screen.
Screen provides the option to have multiple terminal windows from a single connection while preserving the session in the even of dropped connection

I.e after you connect. You will run screen

Then you can do screen new command which will create a new screen that you can use Carl-a screen_number.
When you loose connection you would use screen -D -RR to resume the running screen.
screen -list will display a list of screen session the user has had and you can use this information to resume the session from the list.
http://www.manpagez.com/man/1/screen/
0
 
LVL 2

Author Closing Comment

by:musickmann
ID: 37842325
Wow, I couldn't have asked for a more perfect answer, this is exactly what I Was looking for all this time! I feel like such a derp with always have been creating multiple Putty sessions. DOH!
Thanks!
0
 
LVL 2

Author Comment

by:musickmann
ID: 37860746
I've been using screen, and it's been very helpful. I just had a connection drop again in the middle of the session, but when I logged in again, the previous screen sessions weren't there.

I entered a screen session, began an FTP upload of a very large file
When the connection dropped, I reactivated the session (I use Putty), and went to list screen sessions and there were none, there should have been 2.

Did I misunderstand that screen would allow session recovery after connection drop?
0
 
LVL 79

Expert Comment

by:arnold
ID: 37861096
No, screen is supposed to keep running on disconnect.  could you make sure did not reboot, uptime?
last | more
0
 
LVL 2

Author Comment

by:musickmann
ID: 37861136
Uptime is 5 days running.
I connect VPN to the network, then use Putty to connect to the server if that makes a difference.
0
 
LVL 2

Author Comment

by:musickmann
ID: 37861220
I just tried again to see if it would maintain. I started several screen sessions. Closed the Putty window, when I next login I type screen hit enter, then pull up a list of screens and only 1 is listed.
Is there a special method to reactivate existing screens upon re-logging in?
0
 
LVL 79

Expert Comment

by:arnold
ID: 37861423
screen -list

screen -RDD <session_id> will resume that session.

Lets try to follow your steps. After you login to the server using putty you issue
screen (this is the main session, screen 0 though any remaining active screen means additional windows can be opened using the ctrl-c-ctrl a.)
you then want to access to server2 so you run
screen ssh user@server2 (this will not be opened as the next numerical screen, screen 1 crtl-a w will tell you how many sub sessions exist within this main screen  session. ctrl-a SHift-A will let you change the name of the individual screen sub session so it would be easier similar to using screen -t 'name of sub session')

If the systems to which you were connected reboot, the screen sub session to those will terminate as well.

To detach from your screen session, ctrl-c ctrl-d.
q
0
 
LVL 2

Author Comment

by:musickmann
ID: 37862247
screen list provides
There are screens on:
        31273.pts-4.localhost   (Detached)
        14431.pts-0.localhost   (Detached)
        28313.pts-4.localhost   (Detached)
        29573.test      (Detached)
        30347.pts-4.localhost   (Detached)
        28880.test      (Attached)
        30978.pts-0.localhost   (Detached)
7 Sockets in /var/run/screen/S-root.

Once I login through putty to this server, I only stay in this server, I dont ssh to any other servers.
When I attempt to reconnect to 30347.pts4 putty closes.

I'm going to reboot the server when I can to clear out the screens and then try it again, I wasn't using the screen -list command before, so that might be what I was missing. I will let you know.

I really appreciate the follow up!
0
 
LVL 79

Expert Comment

by:arnold
ID: 37863490
screen -DRR <scketid from the list to resume that session>
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've written this article to illustrate how we can implement a Dynamic Multipoint VPN (DMVPN) with both hub and spokes having a dynamically assigned non-broadcast multiple-access (NBMA) network IP (public IP). Here is the basic setup of DMVPN Pha…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question