I have Matlab running in a Linux session for almost 2 days, and afraid to lose the computations if my network connection fails. Will moving Matlab to the background and starting 'screen' be the answer for that?
Asked
Active
Viewed 78 times
0
-
Actually this question is more similar to the one I asked, as it deals with already-started processes. – Aviv Apr 02 '15 at 09:10
2 Answers
0
No, starting a screen session after a process is started will not help. What you can try is just putting the process in the background. On my Linux (Mint 17) I tried it with another shell and put 'sleep 100000` in the background.
Then I logged off the session and started a new one. The sleep 100000
process was still running and the parent became process 1 (the init process).
Steps were:
sleep 100000
Ctrl+z
bg 1
ps -ef |grep sleep
testuser 7482 7320 0 14:44 pts/11 00:00:00 sleep 10000000
logoff
logon
ps -ef |grep sleep
testuser 7482 1 0 14:44 ? 00:00:00 sleep 10000000
Other systems like Solaris has the nohup
command which allows you to specify a pid to immune to hangups.

Lambert
- 12,680
-
The process is indeed still running, but you can't reconnect to it (STDIN/STDOUT). I needed to reconnect to the Matlab session. – Aviv Apr 02 '15 at 09:18
-
Use
reptyr [-s] pid
in that case, as @Anthon suggested, to reconnect the file descriptors. – Lambert Apr 02 '15 at 18:49