Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

First, if I stop a tar process, will it resume from where it left off or will it have to go through all the directories again (a lot of directories and files).

Second, am I correctly "disown"ing this process?

  1. I ssh'd into my linux (ubuntu) server.

  2. I started a process with 'tar -cf /mnt/backup.tar /var/www'

  3. Several hours later, the process is still running and I need to shut my desktop computer off.

  4. I pressed Ctrl+Z to suspend the process,

  5. then ran 'bg' to resume it in background.

  6. then ran 'disown -h tar'

  7. then ran 'ps faux'

    root      8760  0.0  0.1   8964  3036 ?        Ss   Aug21   0:21  \_ sshd: root@pts/0 
    root      8762  0.0  0.1   4408  1880 pts/0    Ss+  Aug21   0:00  |   \_ -bash
    root     23184  0.2  0.0   3708  1072 pts/0    D    Aug24   3:30  |       \_ tar -cf /mnt/backup.tar www/
    
  8. I see the tar command and it's "STAT" column shows D. Does that mean detached?

  9. I wasn't quite sure exactly what the "job" was, I assumed "tar".

Please let me know if what I am doing is correct and is it now safe to logout and close the ssh session. Would hate to have to restart this process.

Also note, this question has been somewhat answered here: http://serverfault.com/questions/24425/can-i-nohup-screen-an-already-started-process

However, I am extending the question as I was a little confused about using disown and what a "job" actually is.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

When you exit an interactive bash login shell, it sends a SIGHUP to all children unless the shell option huponexit is set to off.

When most userland processes receive a SIGHUP, they will exit.

When you disown -h, you are marking the process to prevent bash from sending a SIGHUP on exit regardless of the shell options. You could have also prefixed the command with nohup to reproduce this same behavior.

As far as STAT D:

An uninterruptible sleep state is a sleep state that cannot handle a signal (such as waiting for disk or network IO (input/output)).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.