LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Recalling jobs started using nohup and "&" (https://www.linuxquestions.org/questions/linux-software-2/recalling-jobs-started-using-nohup-and-and-512331/)

RAdams 12-20-2006 03:14 PM

Recalling jobs started using nohup and "&"
 
If I:
Code:

nohup myjob &
Then of course "myjob" will be started and I can freely exit, perform other tasks, etc, with it still running. However, what happens when I want to bring it back to the foreground? Using "jobs" produces nothing on it, thanks to nohup, running myjobs with the intent to disown it only starts another instance of the program, no affecting the original, and fg doesn't help, because it can't recognize the process, apparently.

Code:

ps -A | grep myjob
That returns the PID of the job, but trying to bring that job to the foreground gives an error "no such job" I can kill the job using the output PID, but I want a way to bring the job back to the foreground.

How can I do this?

farslayer 12-20-2006 03:44 PM

Use screen instead of nohup

You can start a screen session launch your application, script, whatever, then disconnect from the screen. you can later re-attach to the screen easily. .

RAdams 12-21-2006 01:31 AM

Quote:

Originally Posted by farslayer
Use screen instead of nohup

You can start a screen session launch your application, script, whatever, then disconnect from the screen. you can later re-attach to the screen easily. .

I can't sudo. Is there a way around this? (I used "screen -D -RR myjob")

farslayer 12-21-2006 07:15 AM

simply run the screen command alone..
once screen is running you should be able to sudo inside the screen session.. and do whatever you need..


All times are GMT -5. The time now is 05:28 AM.