在分离屏幕会话中运行 shell 脚本。 必须杀。 如何?

发布于 2024-07-29 02:07:50 字数 161 浏览 1 评论 0原文

我是 Ubuntu Linux 用户。 我正在远程运行作业并启动屏幕会话。 在此会话期间,我获取了一个文件,其中包含要执行的一长串命令行参数。 我被迫断开连接,现在作业仍在该屏幕中运行,我无法杀死它们。

有谁知道如何终止此脚本将执行的所有正在运行和将来的命令。 先感谢您。

I am an Ubuntu Linux user. I am running jobs remotely and started a screen session. During this session I sourced a file containing a long list of command lines arguments to be executed. I was forced off of the connection and now the jobs are still running in this screen and I am unable to kill them.

Does anyone know how to kill all running and future commands this script will execute. Thank you in advance.

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

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

发布评论

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

评论(4

就此别过 2024-08-05 02:07:50

如果您只想杀死所有内容,则无需重新连接到屏幕。

只需列出有问题的进程:

pstree -pla

然后杀死任何需要杀死的进程。 请注意,如果您终止进程树上方的进程,它的子进程(通常)也会消失。

If you just want to kill everything there is no need to even reattach to screen.

Just list the offending process(es):

pstree -pla

then kill whatever needs killing. Note that if you kill a process higher up the process tree, its children will (usually) go away as well.

流星番茄 2024-08-05 02:07:50

重新连接屏幕,

screen -D -r

然后您就可以恢复会话。

Reattach the screen with

screen -D -r

then you can resume your session.

夜司空 2024-08-05 02:07:50

使用 ps 识别 shell 进程(bash、tcsh 等)的 pid,然后杀死它...

Use ps to identify the pid of the shell process (bash, tcsh, etc), then kill that...

五里雾 2024-08-05 02:07:50

有几种“屏幕”方法可以终止特定的屏幕会话...

1) 发送“退出”命令:

screen -X -S "sessionname" quit

2) 向运行脚本的屏幕会话发送 Ctrl-C:

screen -X -S "sessionname" stuff "^C"

在这两种情况下,您都需要使用“screen -ls”查找要终止的屏幕会话的会话名称...如果只有一个屏幕会话正在运行,则无需指定 -S“sessionname”参数。

There are a couple of 'screen' ways to kill a specific screen session ...

1) send a 'quit' command:

screen -X -S "sessionname" quit

2) send a Ctrl-C to a screen session running a script:

screen -X -S "sessionname" stuff "^C"

In both cases, you would need to use 'screen -ls' to find the session name of the screen session you want to kill ... if there is only one screen session running, you won't need to specify the -S "sessionname" parameter.

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