Skip to content

vasist/NodeRunner-BashScript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

node-runner

Author: Siva Boyapati

Node ninja runner is a bash script to run Node.js servers. It will automagically restart crashed servers, and will monitor memory usage for you. To prevent out-of-control servers, you can:

  • Control the number of restarts it does in a certain period of time before it gives up.
  • Monitor the amount of memory used by the process and kill it if it exceeds a specified amount.

To use:

bash node_ninja_runner.sh max_mem max_restarts time_period script_name [other args]

For example:

bash node_ninja_runner.sh 100 10 2 personal_blog.js production

This will run personal_blog.js passing in the argument production, with a memory limit of 100M, and will permit no more than 10 crashes within a 2 minute period.

Parameters:

  1. max_mem -- The maximum amount of memory the node process should be allowed to consume. If it exceeds this, it will be terminated and restarted.
  2. max_restarts -- This combines with the next param, time_period, to determine if the app is "runaway" or not. Normally, when node exits because of an uncaught error, node_ninja_runner starts it. If it exceeds max_restarts in time_period minutes, however, then the app is considered runaway and will no longer be restarted.
  3. time_period -- See previous.
  4. script_name -- The name of the node script to run.
  5. You can provide optional arguments to the script to run. These are currently limited to 10 in count.

About

bash script for running the node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%