giovedì 24 novembre 2011

Dimenticato il nohup ? --> risolvi con disown

Può capitare che ci si dimentichi di avviare un processo lungo con nohup e così quando ci si deve scollegare dalla console è un problema !
Si può risolvere come descritto a questo link:

http://www.mind-download.com/2010/01/forgot-to-use-screen-or-nohup-on.html

In pratica si manda in background il processo e si "sgancia" dal terminale attualmente connesso in modo che il processo non viene terminato anche se la shell viene chiusa.


Riporto brevemente il testo

Forgot to use screen or nohup on a command?

Let's say you run a command that is taking much longer to finish executing than you thought it would, and you have to go home. Here's what you do:

1. Press ctrl + z on the terminal to suspend the command.
2. Run: bg to move the last suspended program in the background
3. Run: jobs to list programs running on background
4. disown %1 to pick job #1, %2 if it's the second job on the list. This will mark the job so that SIGHUP is not sent to it if the shell receives a SIGHUP.