2

I need to log into my server and tar up a huge directory of about 150GB, but I need to run the command so when I get back home, it's still running.

can I just SSH into my server from my laptop, run the tar command, and head home? how do I check the status of the tar when I get back home, etc...

thank you

Zoredache
  • 128,755
  • 40
  • 271
  • 413
Andrew Fashion
  • 1,635
  • 7
  • 22
  • 26
  • 1
    Oh, are all these, surprisingly similar, questions related to your home system? – Chopper3 Dec 03 '10 at 19:41
  • I had a life crisis, my development team screwed me over, and I had to transfer everything over immediately to a new server. sorry... That's why so many questions... – Andrew Fashion Dec 03 '10 at 20:03
  • When i say screwed me over, I mean I paid this dev team 50k, and they left everything unfinished, and I have to switch from the current server to the new company fast.... – Andrew Fashion Dec 03 '10 at 20:04
  • @mattdm: You created [sysadmin-basics] tag for this single question? You should have a look at the [related discussion on MSF](http://meta.serverfault.com/questions/490/fundamentals-tag) and the *purpose* of the [tag creation privs](http://serverfault.com/privileges/create-tags). – jscott Dec 03 '10 at 20:42
  • @jscott -- looks consistent with all that, yes. Note that it is more specific than just "beginner". – mattdm Dec 03 '10 at 21:31
  • @mattdm I fail to read anything *"more specific"* in the tag. A [[basics](http://serverfault.com/questions/tagged/basics)] tag already exists. As SF is a syadmin-oriented site, prefixing *"basics"* with *"sysadmin-"* adds little value in the new tag. – jscott Dec 05 '10 at 15:26
  • *shrug*. Retag it to "basics" then. – mattdm Dec 05 '10 at 15:40

3 Answers3

4

You could first execute screen and then run the command within screen.

or

You could run the command using nohup

I would prefer screen as you can resume the session and see the progress.. When you get home run screen -r and it will "reattach" the session you left on your laptop.

jscott
  • 24,204
  • 8
  • 77
  • 99
Dan R
  • 2,275
  • 1
  • 19
  • 27
  • 1
    You might be interested in researching tmux (http://tmux.sourceforge.net/). Personally, I love screen. But looking into tmux transition has been on my to-do list for a while now. – Belmin Fernandez Dec 03 '10 at 21:13
  • Ah yes, I am waiting for http://serverfault.com/questions/208501/does-tmux-have-all-the-features-that-screen-has-and-those-screen-is-missing to have some answers to decide on tmux – Dan R Dec 03 '10 at 21:40
  • 1
    I just saw your question pop up on my RSS feed. Creepy. – Belmin Fernandez Dec 03 '10 at 23:32
3

You need screen, which lets you start one or more shell sessions and then detach from them and reattach to them. If you've never heard of it before, run and read the web page now! It's a fantastically useful tool for just the situation you describe.

larsks
  • 41,276
  • 13
  • 117
  • 170
1

Why not just run your command using at or cron. at is easy but it is not always installed by default, but it should be available from your package manager. Install it then run it like so.

at HH:MM (time 2 minutes or so in future)

it will open a shell, type you commands there

date >/tmp/out 2>&1
tar [your options] >>/tmp/out 2>>&1
date >>/tmp/out 2>>&1

press control-D and start /etc/init.d/atd. Logoff and check back later. Look at /tmp/out for output log.

Or you could use cron

xsaero00
  • 255
  • 3
  • 10