即使连接丢失,也可以从我的计算机在远程计算机上运行脚本

发布于 2024-12-25 18:52:40 字数 159 浏览 2 评论 0原文

我有一台远程计算机,我需要运行一些脚本,例如 ./main.sh

我正在使用 ssh 登录远程计算机并运行脚本,但是当网络连接丢失时,脚本不会运行跑吧。

即使连接丢失,如何从我的计算机在远程计算机上运行脚本?在此用例中是否有 ssh 的替代方案?

I have a remote machine where i need to run some script say ./main.sh

I am using ssh to login to the remote machine and run the script but when the network connection is lost the script doesn't run.

How can i run a script on my remote machine from my machine even when the connection is lost? Are there any alternatives to ssh in this use case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无声情话 2025-01-01 18:52:40

如果远程系统兼容 Unix,标准答案是使用 nohup。

If the remote system is Unix-compatible, the standard answer is to use nohup.

作死小能手 2025-01-01 18:52:40

如果您有权访问该计算机上的 cron,请使用它(请参阅 man cron)进行常规运行。

如果是单例场景,并且您希望它有时在登录后运行(即使连接丢失):登录后,启动 screen 会话并使用 at

If you have access to cron on that machine, use that (see man cron) for regular runs.

If it's a single case scenario, and you want it to run sometimes after logging in (even if the connection is lost): after logging in, start a screen session and use at.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文