简体   繁体   English

取消暂停在不同终端 window 中暂停的 Rails 服务器

[英]Unpause a rails server that was paused in a different terminal window

I'm on mac osx using zsh.我在使用 zsh 的 mac osx 上。 If I start a rails server with "rails s" I can put it in the background by hitting "ctrl-z" in my terminal (zsh).如果我用“rails s”启动一个rails服务器,我可以通过在我的终端(zsh)中点击“ctrl-z”将它放在后台。

If I open up a different terminal window then I don't see the rails server if I do "jobs".如果我打开一个不同的终端 window ,那么如果我做“工作”,我就看不到 Rails 服务器。 However, I can see it when I do "ps".但是,当我执行“ps”时,我可以看到它。

Is there a way I can somehow "unpause" the rails server in this new terminal window?有没有办法可以在这个新终端 window 中以某种方式“取消暂停”rails 服务器?

You can not easily move a process to a new tty .您不能轻易地将进程移动到新的 tty The easiest solution would be to start it in a screen session, detach screen and then resume in the new terminal.最简单的解决方案是在屏幕session 中启动它,分离屏幕,然后在新终端中恢复。

The job is "stopped" by sending it a SIGSTOP .Your Cz doesn't send the job into the background.通过向其发送SIGSTOP将作业“停止”。您的Cz不会将作业发送到后台。 It "stops" it.它“停止”它。 You can then move it into the background using the bg shell builtin.然后,您可以使用内置的bg shell 将其移动到后台。 However, if you send this process a SIGCONT ( kill -CONT <pid> ), it should bring the process back to the foreground.但是,如果您向该进程发送 SIGCONT ( kill -CONT <pid> ),它应该将该进程带回前台。 This can be done from a different shell.这可以通过不同的 shell 完成。

You will not see it if you type jobs because it is a job controlled by a different shell (the other terminal window and not the one where you typed jobs).如果您键入jobs ,您将看不到它,因为它是由不同的 shell 控制的作业(另一个终端 window,而不是您键入作业的终端)。 Processes however are "global" and can be seen from anywhere using the ps command (as you rightly pointed out).但是,进程是“全局的”,可以使用ps命令从任何地方看到(正如您正确指出的那样)。

Update : Looks like I spoke too soon.更新:看来我说得太早了。 Apparently, the signal alone isn't enough to bring it back to the foreground.显然,仅靠信号不足以将其带回前台。 Probably something to do with the shell.可能与 shell 有关。

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

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