问题原文
原帖链接 · DaneSoul · CC BY-SA 3.0
I work on Linux Mint myself, have remote Ubuntu VPS server with root ssh access. I have script on server which makes long data processing (hours or ever days of processing).
Now I can open console on my machine, connect to VPS via ssh and run script - I see what script is doing in real time in my console (how much data processed, how much left and so on refreshes regulary on my console screen) - this works.
How can I do similar, but without dependencies of my local machine:
- Connect to server & run script
- Disconnect and left server to do his long processing work, while I can reboot my local machine or ever shut it down without affecting started server script execution.
- Have possibility to connect later again and see what is current status of process (same data it showed me in real time) without interrupting process.
已采纳解答
原帖链接 · 13dimitar · CC BY-SA 3.0
I think that screen is an ideal solution for you. How it works - you connect to your VPS, type screen, then run your script and detach from the shell (either close your terminal window, or press ctrl+a followed by ctrl+d)
Your script (and shell) will keep running in background. You can view the screen number by typing screen -ls. To restore your session and see the progress/result of your script, get the screen number with screen -ls and then connect to it with screen -r <screen number>. And that's it. After restoring, you can detach in the same manner again.
You can install screen on your VPS with apt-get install screen for Debian based distributions and yum install screen for RedHat based distros.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
