How to foreground a job from another session

3

1

As root, is there a way to foreground (fg) a job within a root session that is in the foreground of another root session? If the job in the other session has to be put in the background (using bg) first, then is there a way (from another session) to bg a job so as to be able to fg it elsewhere?

Bren Goforth Adelante

Posted 2011-10-19T07:30:30.570

Reputation: 31

What are you trying to accomplish? – Yedric – 2012-09-27T16:59:29.540

Answers

2

You could use screen utility for accomplishing what you are trying to do.

Or you could use nohup command when initiating a job and look at the log from any session. If you do not provide an output file name, then nohup.out will be used. Here is an example:

nohup script.sh > logfile.log &

dabest1

Posted 2011-10-19T07:30:30.570

Reputation: 972

1

You can suspend a currently running process by sending SIGSTOP (kill -STOP) to it, and resume another with kill -CONT (SIGCONT). It will still be part of the same session, though – you cannot move it, AFAIK.

user1686

Posted 2011-10-19T07:30:30.570

Reputation: 283 655