简体   繁体   中英

Unpause a rails server that was paused in a different terminal window

I'm on mac osx using zsh. If I start a rails server with "rails s" I can put it in the background by hitting "ctrl-z" in my terminal (zsh).

If I open up a different terminal window then I don't see the rails server if I do "jobs". However, I can see it when I do "ps".

Is there a way I can somehow "unpause" the rails server in this new terminal window?

You can not easily move a process to a new tty . The easiest solution would be to start it in a screen session, detach screen and then resume in the new terminal.

The job is "stopped" by sending it a SIGSTOP .Your Cz doesn't send the job into the background. It "stops" it. You can then move it into the background using the bg shell builtin. However, if you send this process a SIGCONT ( kill -CONT <pid> ), it should bring the process back to the foreground. This can be done from a different 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). Processes however are "global" and can be seen from anywhere using the ps command (as you rightly pointed out).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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