3

Possible Duplicate:
How can I disown a running process and associate it to a new screen shell?

The problem is that the process is not a job inside of my active shell (as I've logged in from remote because my X-system has crashed), meaning: I guess disown, nohup, CTRL+Z & bg, screen et al. will not work.

Motivation: I started a long running job inside of a gnome-terminal. I want to detach it from the its parent, as I the X-system has crashed. I fear when I kill the X-system, also the Gnome Desktop + Gnome-Terminal + my precious script will be lost. So I still can login from remote and want to save the script process and restart X. How do I do that?

9
  • See e.g. serverfault.com/questions/24425/… for an answer. Commented Aug 30, 2012 at 13:36
  • Please take a look at similar question at SuperUser superuser.com/questions/1674/… Commented Aug 30, 2012 at 18:35
  • @jofel: severfaults answer uses disown, which does not work for jobs outside of your current shell. Commented Aug 31, 2012 at 13:11
  • @hostmaster: The answer you selected could solve my problem but will only work for X-applications. I want it to work with any application. Commented Aug 31, 2012 at 13:12
  • @Gilles: Did I said that screen does not work afterwards? Commented Aug 31, 2012 at 13:13

1 Answer 1

1

Depending on the scripting language you use to run the job you could use

setpgrp() Perl: setpgrp PID, PGRP 

to detach the running process from the controlling terminal, so once it starts the controlling terminal can exit without harming the running process.

Now from what you are describing you will have the controlling terminal and shell by running Gnome Terminal and starting your job from there so nohup should work just fine for you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.