1
votes

I am using macOS BigSur. And I am running a script on a gpu on a remote machine using a ssh tunnel. Since the process is long I am using tmux and I want the process continues running when I disconnect from ssh. But the problem is that when ssh is disconnected, the tmux session is also killed.

What I do is as follows:

1- ssh into the remote machine

2- start tmux by typing tmux into the shell

3- start the process inside the started tmux session

4- leave/detach the tmux session by typing Ctrl+b and then d

But once I do that, when I come back and I connect to ssh I find that the process is killed.
Any help is really appreciated. I need to run a script for 3000 epochs and because of this problem I can't.

1
Did you try to run tmux ls to see open sessions and the attaching to the session with tmux attach-session -t session_name/number? If you can't maybe server killed tmux, try running ps to see if tmux is running, if it is killed then all sessions are terminated. If it is running you can try to recreate its socket by sending USR1 signal, pkill -USR1 tmux. - fedjedmedjed

1 Answers

0
votes

Not sure if it's what's happening to you, but I find that when I ssh with the -X flag, then some processes (python3 and matlab, which I run in the terminal) die when I disconnect.

But if I just do ssh with no -X flag, they survive the disconnect.