I was executing a long Mathematica Notebook over night. The Mathematica instance is running on a Linux workstation (in a vnc server session to be precise). Now I cannot access this session anymore, which means that I likely loose the output data which was produced during the run. I can still login on the workstation as the same user and run Mathematica there. I know from the process list that Mathematica is still running, but I cannot access the GUI anymore. So, if there would be a remote control for Mathematica from command line or a second worksheet, which allows me to save the worksheet, I could prevent the data loss. I already tried to run a second instance of Mathematica but it seems that I cannot even see the Kernels there. Any ideas? It would save my day.

  • $\begingroup$ That's why I always write the results of my long calculations to a file. Export[...,"file.mx.gz"] is your friend. Doesn't help you now, I know... $\endgroup$ – Ajasja Jan 23 '14 at 20:18
  • $\begingroup$ Oh, for next time, there is also NotebookAutoSave. $\endgroup$ – Ajasja Jan 23 '14 at 20:20
  • $\begingroup$ I'm afraid there's no good solution here. I've been looking into accessing already running kernels on remote machines to examine and change their state a couple of years ago. If you don't already have some setup to enable this, then I don't think it's worth spending any more effort. Just re-run the calculation next time you can access the machine and make sure the results are saved at the end of the calculation using Export. $\endgroup$ – Szabolcs Jan 23 '14 at 20:44
  • 1
    $\begingroup$ Oh, and beware of .mx! It's not cross platform or cross-version. Never keep important data in .mx. An cross-platform, cross-version alternative is to Compress your expressions and write the resulting string into a file. I use zimport[filename_] := Uncompress@Import[filename, "String"]; zexport[filename_, data_] := Export[filename, Compress[data], "String"] $\endgroup$ – Szabolcs Jan 23 '14 at 20:45
  • $\begingroup$ Ok, guys thanks for the hints. What's your experience with the NotebookAutoSave feature? Is it stable? My experience with other software is that it may crash while saving, especially if the files are big. It can then leave the files in an inconsistent/partial state. $\endgroup$ – highsciguy Jan 24 '14 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.