0

I am using my Ubuntu remotely via SSH mainly to use Python and manage data science projects. I usually run my scripts through shell files. I use tqdm to track processes times.
When I disconnect from the PC and let it continue the processes in the background, things that should have been taken 15 minutes suddenly increase to hours.
Why is that and what can I do to bypass it?

1 Answers1

1

An easy way to check whether disconnecting is an issue, is to run GNU screen or tmux in your remote ssh session (both are in the main Ubuntu package repositories). Then run your scripts from within the screen/tmux window.

The key feature of screen/tmux we want is the ability to keep shells and child processes running even when the remote session is disconnected. Shells/children inside the screen/tmux window won't notice, because they're running on a pty owned by screen/tmux, not owned by the remote login process (in this case sshd).

In general, I run long-lived commands inside a screen/tmux session, even locally. There are various other benefits that I won't detail here.

Moving on, to help you find the root cause, it would be easier if you provide more detail about the exact steps you take. You connect via ssh and get a shell on the remote machine. Do you then just run the script in the background with something like "myScript &", then log out? Do you use "nohup myScript &"?

klode
  • 44