I'm feeling a lot better now, but I've been working more remotely, and more and more operations such as machine learning are being performed on remote servers. The reason is that my laptop isn't very specs, but it doesn't have enough specs. Of course it is good to use google colab, but if you do not operate it for a long time, it will time out and the performance of the GPU that can be used is limited.
I was always typing commands on the server I sshed to, but I kept the connection in order to keep the process sshed alive. .. But when I thought about it, I didn't have to do that at all.
https://qiita.com/kenmaro/items/a548a302228029c5c870
As explained in detail here, by setting ssh authentication and editing `` `~ / .ssh / config, For example, an ssh connection to
my_remote_pc```
ssh my_remote_pc
You will be able to connect to ssh very easily.
Also, many people may have done the command background locally.
For example, if you want to run ``` python main.py
in the background, just add
&` `` at the end of the command.
python main.py &
If you mix the above two, you can run it in the background on the server you sshed to. Now, even if you disconnect the ssh connection, the process will run on the remote server.
It's easy to do, `ssh <***>" <***> & "`
. In the previous example,
ssh my_remote_pc "python main.py &"
Only this.
Now you don't have to bother checking the ssh connection to see if the process is running.
I think most people take it for granted, but I'm sure there are people like me who are doing something inconvenient and useless, so I hope it helps.
This was much easier to do.
You only need about 3 commands to remember.
screen
First, create a virtual terminal (called a session).
Then perform some task.
ctrl-a --> d
Leave the terminal created by this command. (Detach)
screen -ls
To list the sessions in
screen -r <session id>
Reconnect with.
Around here.
end.
Recommended Posts