Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I had a job running in the background in a shell... I closed the session... Now I reconnect, I can see the process still running, but the terminal is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2008
    Posts
    19

    Recover Linux Job from Old Terminal Session?


    Hi, I had a job running in the background in a shell... I closed the session...

    Now I reconnect, I can see the process still running, but the terminal is coming up as ?

    boss 19609 0.0 0.0 63880 1128 ? S 10:28 0:01 /bin/bash ./netstat.sh

    Is there a way I can get control of this job again without having to just kill it off?

    Steve

  2. #2
    Just Joined! Feeyo's Avatar
    Join Date
    Apr 2010
    Posts
    54
    Normally it auto kills the job when you close the session.

    But execute: jobs to get a list of running jobs.
    Then type: fg # to get it back to the foreground.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,517
    It has been effectively nohup'd so killing the session didn't also kill the process. The problem is reattaching it to another session (shell), which I'm not sure how to accomplish, sorry...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    This is essentially what the screen utility is for: you can leave a screen session running, logout, login later, and reconnect to screen, and it's as though you never left.

    However, given the current circumstance, I don't believe that you can reconnect to that process: it is now completely inaccessible.

    It might be interesting to know where its stdin and stdout are going: you can check the stdout and stdin file descriptors by running:
    Code:
    ls -l /proc/19609/fd
    0 points to stdin and 1 points to stdout (2 points to stderr). Using these links, you may be able to see where input is coming from / going to, and get data from the process that way.

    Of course, if it's /dev/null, you're out of luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •