0

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). I can restart it with "fg".

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?

Alto
  • 3
  • 2

1 Answers1

2

Yes, find out the process number of the rails process, then send it the continue signal using kill(1).

$> kill -s CONT pid

uvesten
  • 284
  • 3
  • 9
  • Where `pid` is the process id, obviously. Your `kill` command might have different syntax, if the above doesn't work, try `man kill` on your system. – uvesten May 04 '11 at 16:09
  • I don't know why but it's not working. I do `kill -l` to list the commands and I see CONT. So I try `kill -CONT 88402` and then I just see a new terminal prompt...nothing seems to happen. – Alto May 04 '11 at 23:26
  • You wouldn't see the process' output in the terminal you're sending the continue signal from, it would still go to the terminal that the process was originally attached to. – uvesten May 05 '11 at 07:38
  • To be able to attach and detach to processes (and watch their output, etc.) you should be using [GNU screen](http://www.gnu.org/software/screen/), it's available for almost all unix-like os:es. – uvesten May 05 '11 at 07:39
  • @uvesten could I use tmux in the same way as screen? – Alto May 06 '11 at 09:52
  • dunno, have never used tmux. – uvesten May 06 '11 at 10:37