Issue
I executed the command below in a linux shell:
$ nohup run &
Here run
is a blocking command. Then I close the shell and start a new one. However in the new shell I cannot bring the task to foreground via fg
, nor can I see it via jobs
. Is there still a way to bring it to foreground?
Solution
Use screen
instead of nohup
:
screen -dmS demo bash -c 'while ! read -t 1;do echo $((i++));done'
Note: there are no &
.
Then exit... Later, you could:
screen -x demo
Hit keys Ctrl+a, then d to leave console running
Or
gnome-terminal -e 'screen -x demo'
Then, simply close window to leave process running.
Answered By - techno Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.