Solved screen command how to keep the session always even the network disconnect ?

dear all :
i have question about screen command. i have 3 machines (one windows 10 , one freebsd14.1 one. centos7),
i have used ssh from win10 remote login centos7 , then i have used scp in centos 7 cp 300GB file to freebsd14 .
1. this action will spend more time. how to close win10 ssh, but keep scp command still running always in centos 7?
2.i search internet and getting gnu screen tools can do this . but , i don't know what technological to do that with screen tools ......
3.any one have same tools in freebsd ?
thanks.
 
After having installed tmux in Centos:

1) ssh from windows to Centos
2) In centos start #tmux, and in the tmux terminal do #scp to Freebsd and detach tmux with: ^B d
3) logout, login when you want, attach tmux with: #tmux attach
4) If you detached many sessions do "#tmux ls" and "#tmux attach -t sessionid"

With screen perhaps similar?

Other alternative could be to start scp in Centos with something like nohup(1).
In your case, you do not need to reattach.
 
check tmux(1)
Thanks VladiBG for pointing this out. I was blissfully unaware of this utility for most of time working with FreeBSD and now I realise how much work it would have saved me if I had come across it earlier.

Have looked at the link above I see that I'm only using about 0.1% of it capabilities and hope to pick up a few tips from the Wiki.

One thing I'm unclear about it is https://github.com/tmux/tmux/wiki/Clipboard#setting-the-ms-capability

the-ms-capability is not defined. Does it simply mean Microsoft's CUA?
 
dear all :
i have question about screen command. i have 3 machines (one windows 10 , one freebsd14.1 one. centos7),
i have used ssh from win10 remote login centos7 , then i have used scp in centos 7 cp 300GB file to freebsd14 .
1. this action will spend more time. how to close win10 ssh, but keep scp command still running always in centos 7?
2.i search internet and getting gnu screen tools can do this . but , i don't know what technological to do that with screen tools ......
3.any one have same tools in freebsd ?
thanks.

nohup is the level0 command to achieve this. Then, have a look to screen or tmux for enhanced capabilities.
 
But what about the scp process from Centos to Freebsd called with nohup?
Will it die after ending ssh from Windows to Centos?!

The agent is only used for establishing the ssh connection. A single scp will finish even if the agent disappears during its runtime.
 
The agent is only used for establishing the ssh connection. A single scp will finish even if the agent disappears during its runtime.
I do not really understand. I have just made an experiment. I called from an xterm

nohup ssh remote-server and killed the xterm with twm's destroy by server.
I did the same, but without nohup.

In the first case I saw with ps in other window ssh alive, in the second case not alive.
Of course I killed ssh before calling it again without nohup.

This means, ssh is in the first case immune to the HUP sent by the parent process, in the second not.

Is with scp different?
 
I am a big tmux fan, but it is overkill here if the only goal is to start a single scp and let it complete after the controlling process (in OP’s case an SSH from a third box) exits.

Simply starting the scp as nohup scp <args> should achieve the goal here. (Using nohup(1) causes the following command to ignore the HUP / hang up signal from the closing ssh session.) Note output (status messages) will be in ./nohup.out
 
I am a big tmux fan, but it is overkill here if the only goal is to start a single scp and let it complete after the controlling process (in OP’s case an SSH from a third box) exits.
And a follow up, the main reason it’s overkill here, is that there is no further interaction to be had with the scp command. There’s no chance that, once it has successfully started, that it’s going to come back and have something for you to interact with later. If there were, it would be an excellent candidate for tmux.
 
And a follow up, the main reason it’s overkill here, is that there is no further interaction to be had with the scp command. There’s no chance that, once it has successfully started, that it’s going to come back and have something for you to interact with later. If there were, it would be an excellent candidate for tmux.
One wants to see that scp terminated without error, stdout and stderr must be redirected, and that is done by
FreeBSDs /usr/bin/nohup. But some shells have built in nohups that may behave differently and have
preference in the path.

tmux may be overkill, but is perhaps more comfortable.
 
Detach the screen session; <ctrl>-A, d. Or just quit the ssh session, screen will automatically detach. Or run screen -DR from the other system.


sysutils/screen or sysutils/tmux
Dear sir dice and other's :
thanks. my question is , when i use screen ssh remote access the server . , and execute scp command in this screen , this command will spend 3 hours. now i use ctrl+a+D to quit from this session, then power off this computer . is scp command still running in server ? thanks.
 
Back
Top