lost connection to linux server while running tar command

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?
musickmannData AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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.
musickmannData AnalystAuthor Commented:
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?
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
musickmannData AnalystAuthor Commented:
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!
musickmannData AnalystAuthor Commented:
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?
No, screen is supposed to keep running on disconnect.  could you make sure did not reboot, uptime?
last | more
musickmannData AnalystAuthor Commented:
Uptime is 5 days running.
I connect VPN to the network, then use Putty to connect to the server if that makes a difference.
musickmannData AnalystAuthor Commented:
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?
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.
musickmannData AnalystAuthor Commented:
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!
screen -DRR <scketid from the list to resume that session>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSH / Telnet Software

From novice to tech pro — start learning today.