Art*_*ero 7 scripting bash ssh remote shell-script
ssh
可以用来运行远程命令。
ssh me@server.com 'long-script.sh'
Run Code Online (Sandbox Code Playgroud)
我运行了一个需要很多时间的长脚本,但我想关闭我的计算机并继续在远程服务器中运行该脚本。我知道如何使用GNU Screen实现这一点,但我需要通过ssh
.
我可以在不中断我的脚本的情况下做到这一点吗?
使用“nohup”运行一个不受挂起影响的命令,输出到非 tty:
nohup your_command &
Run Code Online (Sandbox Code Playgroud)
并通过 ssh 运行命令,而无需先登录远程机器:
ssh user_name@machine_address "nohup your_script.sh" &
Run Code Online (Sandbox Code Playgroud)