0

I run a job using nohup & and get job id xxxxx. By using the command jobs -l I can see my job and it's associated id while in the same session. However, when I close my putty session and open a new session jobs -l no longer returns my job. How can this be corrected?

I know for certain the job is still running because file sizes as a result of the job keep growing (working with half a billion rows of data).

nobody
  • 19,814
  • 17
  • 56
  • 77
Lyle
  • 219
  • 1
  • 4
  • 12
  • If you need to start a process and come back to monitor/control it later, `screen` or `tmux` is probably more suitable to your needs than `nohup`/background jobs. – nobody Apr 02 '15 at 23:43

2 Answers2

1

According to Linux Server Hacks, the answer is "no", you cannot reconnect in this scenario: the parent process has died. If you had done this from screen or tmux, then reattaching to those sessions would give you back the parent process.

As an alternative, you can attach to your process with a debugger such as gdb, or a tool such as strace. That aspect has been covered in other questions:

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
0

Try the ps command, which you can use to find all processes running on a system. Specifically, when you log back in, type:

ps -ef | grep xxxx

where xxxxx is the process id reported by nohup.

Matthew Nizol
  • 2,609
  • 1
  • 18
  • 22
  • I think the OP wants to be able to interact with the process again. They know it's still running because its output file is growing, so seeing its entry in the process list isn't adding much. – nobody Apr 02 '15 at 23:50