【问题标题】:Ctrl-Z sent to Fedora server over telnet does not stop the process通过 telnet 发送到 Fedora 服务器的 Ctrl-Z 不会停止进程
【发布时间】:2015-04-07 11:03:00
【问题描述】:

目标:

我正在开发一个 iOS 终端模拟器,用于通过 telnet 协议访问我的 Unix 服务器。我正在针对 AIX 和 Fedora Linux 进行测试。

问题:

如果我将 Ctrl-Z (ASCII 26) 发送到 AIX 服务器,它会按预期运行:我会返回一个类似 stopped programname 的字符串,然后我发送的任何其他字符都会得到回显。

当我将它发送到 Fedora 服务器时,在我再次发送 Ctrl-Z 之前,我没有收到回显。该程序在 Fedora 机器上的 Bash 下运行。

为什么我会看到这种行为差异?

【问题讨论】:

  • AIX 和“Red Hat”的区别行为举个例子I ran the command "yes hello". So hello was printing on the screen until i press "CTRL+Z" to abort it. So i sent the appropriate code for CTRL+Z which is 26. In case of AIX it will return some data "stopped yes hello" and after this if i pressed any character , server send back result. In case of "Red Hat" i received DM (242). After this each character i pressed, do not display back from the server until i press CTRL+Z again.
  • 我正在使用 BASH 单元格。
  • 确定程序在 Bash 下运行吗?您是否打开了另一个终端并运行类似ps -e --forest 的命令来检查其亲子关系?
  • 如果您使用另一台机器上的交互式telnet 程序,它是否可以正常工作?
  • @WarrenYoung 是的,我确信“Bash”。我有一个软件,其中 this(ps -e --forest) 命令与我的模拟器中的运行相同。是的,它可以在另一台机器的 telnet 程序中正常工作。

标签: ios shell unix telnet terminal-emulator


【解决方案1】:

您必须拨打 2 个电话:

  1. 停止该进程

    kill -SIGSTOP 'pgrep process_name'

  2. 继续这个过程

    kill -SIGCONT 'pgrep process_name'

SIGSTOP 告诉进程“坚持”,而 SIGCONT 告诉进程 “从上次停下的地方继续”


看看,是否有帮助。

【讨论】:

  • 如何在 telnet 仿真中实现这一点,因为我不知道 process_name
  • 那么,您暂停进程的依据是什么?或者你怎么知道要挂起哪个进程。
  • 我运行了命令yes hello。所以你好在屏幕上打印,直到我按“CTRL+Z”中止它。所以我发送了适当的 CTRL+Z 代码,即 26。作为回报,我收到了 DM (242)。在我按下的每个字符之后,在我再次按下 CTRL+Z 之前不要从服务器显示回来。
  • 好的,我得到了进程的 startTime 和 tty 以及 command_name 和 PID 的列表
  • 太棒了!您可以通过执行以下操作来获取少量过程:head -n 5,这将为您提供 5 个条目。在此基础上,您可以杀死他们。
猜你喜欢
  • 2019-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-21
  • 1970-01-01
  • 2017-10-02
  • 1970-01-01
相关资源
最近更新 更多