Linux – Writing to stdin of background process

background-processbashlinuxstdin

I'm on an Ubuntu 10.04 box, and started a server in the background (myserver &) over ssh. It's been running fine, but I need a way to get at the server's stdin, as the only way to control the server is through this method.

Is there some way to get at the stdin of an already-running process so I can write to it (and hopefully read its stdout)? Obviously, if I were going to be doing this now, I'd start it with a FIFO redirecting to stdin, but unfortunately it's a little late for that now.

Any ideas?

Best Answer

You could try writing to it's /proc pid directory. Say your daemons' pid is 2000, try writing to /proc/2000/fd/0