I am trying to use a GNU screen session to go through a long code line by line to debug. I'm working in it through a shell. I start the screen with screen -S Name
. Normally I run a few lines of computation and those take a while so I leave terminal open. Sometimes the pipe breaks to my ssh so I close out terminal. When I come back a few hours later and try screen -r Name
, the screen is gone and doesn't show up with screen -ls
. Was it deleted? How can I stop this from happening? I can't progress with my work because I keep losing it
-
What SSH client are you using? Are you connecting from a Windows client? Another Linux machine? The GNU session is on a Linux machine, not running on Cygwin on a Windows setup?– BilfredNov 24, 2015 at 3:12
-
I'm using a mac terminal that is connecting to a ssh in Chicago, I think the other computer is linux– EvanNov 24, 2015 at 3:25
1 Answer
I'm fairly sure that most ssh clients log out of the server when they disconnect/log out/lose connection - in which case, the server drops all the processes that user had running in the active ssh Window. One solution you could try is to do nohup screen -S name
, which will run the command but will accept no keyboard input and will not output to the console - instead outputting the console to a nohup.out
file in the folder where you run the command. Some commands, however, don't run under nohup
, so you may be out of luck running the command through nohup
, although I have been able to run commands that don't work by calling a *.sh
script through nohup. Hope this helps.
-
How do I run a big code then? I want to run an Rscript line by line interactively to debug but my Mac can't handle it. And some of the lines take too long in my ssh that I get logged out? My boss said to use screen– EvanNov 24, 2015 at 3:57
-
personally, I've never had experience with
screen
, so I'm not too sure. Thenohup
command outputs to a file, so couldn't you just go back and look through that? I'm just telling you a method that works for me with other applications that close when I exit the ssh console (one prime culprit is the minecraft/craftbukkit server).– BilfredNov 24, 2015 at 3:59 -
can
nohup
interactively run R and let me look at data.frames to analyze where my errors are– EvanNov 24, 2015 at 4:01 -
nohup cannot run interactively, it accepts no keyboard input when it's running– BilfredNov 24, 2015 at 4:01