this is my situation: I usually run Rfrom Emacsusing ESSin a terminal emulator on my local computer. At my workplace, we get a new server under control R, so I use a remote server through ssh. I connect through sshand everything works well. What I would do is to maintain the console Rwhile I close my laptop and return home, so from my house I would reconnect to the existing session R. I tried to put the console Rin the background, using C-q C-z Enterto stop the process, but while I close the ssh connection, the processes are destroyed. No luck using bg &either. I also triedmoshbut in this case I get some problem related to UDP traffic on my work network. Screenand tmuxalso not very useful due to their poor interaction with Emacs eshell. On the client and server computer, I am running Debian 8 xfce.
Is there a way to save the R terminal when closing the ssh connection? What is your approach to long R sessions?
EDIT
Finally here and here I found the solutio that I am looking for. I tried the same approach as in the link above, but using tmux, and I get a lot of errors. The holy grail is the screen. I tried a step-by-step procedure, but I get an error message from emacs while I try to connect a screen session from inside eshell. So I tried using ansi-term instead of eshell, and everything works as expected. I can attach and detach the R session. Thus, I use the remote server machine only for calculation, while the R scripts are on my laptop. So this is the workflow:
ssh to the main server- start
Screensession - start
R - disconnect
Screen - exit server closing ssh connection
Emacs emacsclient
instance ( emacs emacsclient,
)R scriptansi-term (M-x ansi-term)ssh ansi-term- (
screen -r) R R script (M-x ess-remote)- R ansi-term
Ctrl-q Ctrl-a d return
. R R script, , R, , IP-.