Monday, March 22, 2010

Keeping processes running after logging out from a remote server

Sometimes, the workstation at my desk is not enough for running a simulation and simultaneous on-line procrastination; enter the workstation or the cluster of our theoretical optics group.

While a cluster usually has a queue manager, a workstation usually lacks this software. In our case, both cluster and workstation lack a queue manager. Now, a queue manager usually keeps a process running in the remote server no matter what your logged status is. How to do the same without a queue manager? The answer is simple: nohup.

For simplicity's sake, I'm using an SSH connection to a linux machine if I want to leave a process running at the server and then log out I use the command:


nohup command_to_run &

Note that the ampersand symbol has to be issued in order to send the process to the background.

Say, for example, I want to leave the compiled binary file for a fortran program running in the remote server even if I log out:


nohup ./BinFile &


Or a matlab m-file script, please remind yourself to always add an exit command at the end of your script or you will end up with many matlab iddle processes running in the background:


nohup matlab -r MatlabScript.m -nodesktop -nojvm -nosplash &


Or a mathematica m-file function, again remind yourself to add an Exit[] command at the end of your script or you will end up with an iddle mathematica process running in the background:


nohup math -noprompt -run "<<MathematicaFunction.m" &

Usually, all the terminal messages from the processes are written to a file named: nohup.out



1 comment:

  1. "screen" may also be helpful..

    http://www.kuro5hin.org/story/2004/3/9/16838/14935

    http://ask.slashdot.org/article.pl?sid=08%2F06%2F29%2F1417247&from=rss&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Slashdot%2Fslashdot+%28Slashdot%29&utm_content=Google+Reader

    ReplyDelete