1

A lot of newbs will kill all their node.js processes on their local machines with

pkill -f node

Or

killall node

Etc.

I have a library that uses some daemon processes/workers running on the developer's machine and I will need to restart them if the development "accidentally" kills (all) node.js processes.

The problem is that using NPM libs like forever or supervisor will not solve this problem because they are node.js processes as well TMK.

Can anyone recommend a daemon watcher / relauncher system that will work on MacOS or *nix?

Perhaps supervisord can do what I want to do on both MacOS and *nix? Or perhaps there is another solution to this problem?

Alexander Mills
  • 1
  • 80
  • 344
  • 642
  • Or perhaps `forever` and `supervisor` can handle the cases where the user issues `pkill -f node` or `killall node`? –  Nov 14 '17 at 18:11
  • This seems more a question about users permissions on the machine. Also not sure why these _newbs_ would want to do that. – TGrif Nov 15 '17 at 12:04

1 Answers1

0

I wrote node-windows, node-mac, and node-linux for this purpose. They are essentially wrappers around node processes, but all three libraries share a common API for managing things like restarts/stop/start/etc.

Corey
  • 4,266
  • 2
  • 21
  • 20
  • Why the downvote? These tools solve this exact problem for thousands of developers. – Corey Nov 14 '17 at 20:43
  • I didn't downvote, not sure why someone would do such a thing –  Nov 14 '17 at 21:05
  • are they wrapped with a node executable or a binary thing? Because if they are wrapped in a node executable, then I assume `pkill -f node` will kill the wrapper process too, which is the problem described in the question. –  Nov 14 '17 at 21:06
  • 1
    The wrapper is not node-based. On windows the parent process is a winsw process, Mac uses a launch daemon, and Linux uses SystemV (SystemD options available too). A `pkill -f node` will still kill the node process, but since node is a child of the wrapper process, the wrapper will restart the node process (if configured to do so). – Corey Nov 15 '17 at 16:17
  • ah cool man, now it makes sense, if you think the original question is a good one, you know what to do, will see if I can make your libs work for me –  Nov 15 '17 at 17:52