Forever.js: Using one instance for multiple users


I've got Forever.js running, but what I'm trying now is to let more than one user use the same Forever.js instance.

If I start a file with Forever.js right now, I cannot see/stop/restart it with another user. If I do Forever.js list there, it shows that nothing is running.

I've tried some things with setting the config values differently, for example: forever set root '/tools/node/forever' and get back Forever config saved: /tools/node/forever/config.json, but when I run forever config then, the file is reset back to what is was.

Would I be able to set the config from both users to the same folder, and would it then share the same Forever.js instance?

Problem courtesy of: Martin


Forever stores the current processesin the users home directory, so you can't share the same process with several users. The easiest way is to set up a service-user and switch to that user whenever you need to stop/restart your process (which shouldn't be too often).

Alternatively, you can set up an init.d script as described in this guide: Running a Node.js Server as a Service Using Forever.

Solution courtesy of: Patrick


Another possibility would be to kill the forever process after ps -aux | grep forever

Discussion courtesy of: faeb187

This recipe can be found in it's original form on Stack Over Flow.