Analytics


Google

Friday, September 25, 2009

Daemonize a process in Unix

In unix when we run a command, it will usually run in the foreground and take over our terminal.

For long running processes, we can add & to create a child process to run the background. This will allow you to continue to use the terminal while waiting for the process to finish. However, for that process is still tied to the parent process and will terminate if you exit from your terminal.

Sometimes we want to start a process and let it continue to run even after we exit out of our terminal. This can be done using the nohup command.

For example, if we want to start the WebLogic server and have it continue serving out our web application even after we log out of the server. To do that just type:

nohup ./startWebLogic.sh &

All output will be redirected to a file called nohup.out but the WebLogic server process will continue to run even after we have logged out of the server.

No comments: