How can I stop a process from moving to the background?

Posted by Alex on Ask Ubuntu See other posts from Ask Ubuntu or by Alex
Published on 2013-11-07T15:06:07Z Indexed on 2013/11/07 16:13 UTC
Read the original article Hit count: 259

Filed under:
|
|

I have a machine running Ubuntu server version 12.04.3 LTS. On it, I'm attempting to run a node.js server that needs to stay up and running at all times. I'm running into an issue, however, where periodically I see this happen:

[1]+  Stopped                 sudo node server.js

When this happens, I have to manually bring it back with fg, which works fine, at least until it stops again. As far as I can tell, it isn't functioning properly while stopped, since I get no log files in those windows of time. So my question is this: Is there a way to prevent it from being stopped like that? I'm running it in a tmux window, if that changes anything.

Also, to address the question before it gets asked: I'm running it as sudo due to some ecryptfs issues I've been having. I was originally running it in my home directory, but when it was left alive for too long things would get out of sync and the file writes it has to do would just stop working. To mitigate that, I moved it out of my home directory, but its new location requires me to use sudo permissions for everything to work correctly. Hopefully that isn't related to the whole background task thing.

(sudo and tmux tags included in case one or both turn out to actually be relevant to the solution.)

© Ask Ubuntu or respective owner

Related posts about sudo

Related posts about tmux