Reputation: 11
here is my problem: i would like to run a Mathematica script through ssh on a remote machine so that i can close the terminal on my computer and keep it running on the remote one.
My problem arises because the script acts in interacting mode, and so when i close the terminal the process is shut down too.
Thanks.
Upvotes: 1
Views: 2470
Reputation: 3355
Several cases:
If you don't need to interact with it or need to visualize the notebook during evaluation
Then, to run a kernel in the background and detach it from the current session, use nohup
tool (the standard output of the command will be dumped to myNotebook.out):
nohup math < myNotebook.nb > myNotebook.out &
Optionally you can monitor math
command output with the tail
command (use CTRL-C to exit the tail
monitoring)
tail -f myNotebook.out
If you need to see what's going on, visualize graphs during calculation or to be able to interact graphically, use remote desktop (vnc) and tunnel your communication with remote machine. Details depends a bit on the Linux distribution (vnc clients & servers may differ). You can even from Windows or Mac connect with remote desktop to your linux box and manipulate it. I suggest you to search the web for remote desktop
ssh tunnel
+ your distro for tutorials.
Upvotes: 1
Reputation: 47062
Use tmux or GNU screen.
Workflow:
tmux
or screen
Then later:
tmux attach
or screen -d -R
Upvotes: 3