简体   繁体   English

如果 SSH 会话断开连接,通过 SSH 在 Vmware ESXI 主机外壳上运行的进程是否会继续?

[英]Will processes running on Vmware ESXI host shell via SSH continue if SSH session is disconnected?

I've got a VMware ESXi server that I connected to via SSH to run a process.我有一个 VMware ESXi 服务器,我通过 SSH 连接到它来运行一个进程。 (I was running "vmkfstools --punchzero myVirtualDrive.vmdk" to reclaim space on a virtual disk). (我正在运行“vmkfstools --punchzero myVirtualDrive.vmdk”来回收虚拟磁盘上的空间)。 The SSH client connection was disconnected when the process was only 70% complete (with several hours of estimated time remaining).当该过程仅完成 70% 时(估计还剩下几个小时的时间),SSH 客户端连接被断开。

  1. Was the process terminated when the SSH client dropped its connection to the ESXi host?当 SSH 客户端断开与 ESXi 主机的连接时,进程是否终止?
  2. Is there any way to tell if the process is still running?有什么办法可以判断进程是否仍在运行?
    I did a quick ps|grep to find it, but didn't see anything that looked like vmkfstools.我做了一个快速的 ps|grep 找到它,但没有看到任何看起来像 vmkfstools 的东西。

On most standard linux machines, I use "screen" to avoid SSH client disconnection issues, but since the ESXi shell is purposely a very stripped down environment, I just ran the command straight away.在大多数标准 linux 机器上,我使用“屏幕”来避免 SSH 客户端断开连接问题,但由于 ESXi shell 是一个非常精简的环境,我直接运行了命令。

Thoughts?想法?

The command was killed when you disconnected.当您断开连接时,该命令被终止。

What you can do to prevent this in the future is to run the command with nohup .为了防止将来发生这种情况,您可以做的是使用nohup运行该命令。 This will run your command in the background, continuing even when your shell "hangs up".这将在后台运行您的命令,即使您的外壳“挂断”也会继续。

What I usually do when I expect a command to run long:当我希望命令运行很长时间时,我通常会做什么:

  • I ssh to a Linux machine that runs 24/7我通过 ssh 连接到一台 24/7 全天候运行的 Linux 机器
  • start screen开始画面
  • ssh to the ESXi host ssh 到 ESXi 主机
  • start the command启动命令

This way I don't have to worry about disconnects, I can just detach screen and go home after work and reattach screen the next morning to check the status of the command.这样我就不用担心断开连接了,我可以在下班后分离屏幕并回家,第二天早上重新连接屏幕以检查命令的状态。

This was exactly what I was looking for, thanks all.这正是我要找的,谢谢大家。 I attempted to unmap unused block on LUNs which is vmfs 5 file system.我试图在 vmfs 5 文件系统的 LUN 上取消映射未使用的块。 I run this cmd esxcli storage vmfs unmap -l [LUN-NAME] I wonder that what will happen if I close remote SSH connection while this cmd process still running.我运行这个 cmd esxcli storage vmfs unmap -l [LUN-NAME]我想知道如果我在这个 cmd 进程仍在运行时关闭远程 SSH 连接会发生什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM