LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Need alternate for nohup. (https://www.linuxquestions.org/questions/linux-server-73/need-alternate-for-nohup-803107/)

karthiksharu 04-20-2010 01:59 PM

Need alternate for nohup.
 
Hi all.. I am a beginner sytem admin. our developers do nohup xxx.py &. I was said that there are much better 'daemons' which are far better than nohup. Can anyone advice me how do I start researching on this or any pointer or any such daemon tool which can replace the nohup.?

Thanks in advance for any answers....

AlucardZero 04-20-2010 02:07 PM

There's no "better" nohup replacement that I know of. Do you mean making your python scripts daemonize themselves? http://stackoverflow.com/questions/1...cript-in-linux

chrism01 04-20-2010 08:45 PM

Agree with AlucardZero. In fact, nohup isn't a daemon anyway, it prevents the associated program from terminating when the controlling terminal exits. Short for 'no-hangup'; dates back to old days when all remote access (non-console) was over phone lines eg acoustic modems.
Hanging up the phone caused logout/exit and killed any prog associated with that terminal to exit.
NB '&' only sends the program to the background, BUT it's still associated with the originating terminal.

karthiksharu 04-21-2010 12:20 AM

the real problem i am facing is that. I am running the scripts from remote. lets say,
ssh 192.168.x.xx python startmyserver.py

startmyserver.py(which is in remote at 192.168.x.xx) contains
`nohup startoneprocess.py &`
`nohup starttwoprocess.py &`

so when I do from my machine `ssh 192.168.x.xx python startmyserver.py` the nohup.out is not created. This is because ssh being non-interactive. But the parent of the processes startoneprocess.py and starttwoprocess.py are not terminal. Its 1. So I dont have to worry about process getting killed when closing the terminal.

The solution would be `nohup starttwoprocess.py >nohup.out 2>&1 &`

Changing the scripts to redirect to nohup will not be a problem for us. But it ll be a temporary solution. Need a permanent solution. I have heard that there are daemonizing productions(opensource/may be not) available in the markets that we can use. So I get some advice on this situation.

Please correct me if I am wrong.

Thanks in advance...

AlucardZero 04-21-2010 08:42 AM

You don't need a "daemonizing production." Just make your python scripts daemonize themselves. I have linked you to one how-to in my previous post, and there are more on Google.


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