Skip to content

Instantly share code, notes, and snippets.

@shurane
Created September 4, 2014 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shurane/82718f08bb9a6b683342 to your computer and use it in GitHub Desktop.
Save shurane/82718f08bb9a6b683342 to your computer and use it in GitHub Desktop.
PM2 managing arbitrary binaries. Thanks @ravi and pm2 issue #471!
[{
"name" : "redis-server",
"script": "/usr/local/bin/redis-server",
"instances" : 1,
"out_file" : "redis-server.log",
"error_file" : "redis-server.error",
"exec_interpreter" : "none",
"exec_mode" : "fork_mode"
}, {
"name" : "mongod",
"script": "/usr/local/bin/mongod",
"args": "['--dbpath=.']",
"cwd": ".",
"instances" : 1,
"out_file" : "mongod.log",
"error_file" : "mongod.error",
"exec_interpreter" : "none",
"exec_mode" : "fork_mode"
}]
@shurane
Copy link
Author

shurane commented Sep 4, 2014

PM2 managing arbitrary binaries. In this case, redis and mongodb on OS X. Feel free to modify this if you like. This has been possible since Ravi's PR issue link at Unitech/pm2#471. "cwd" line is shown for gratuitous effect, but is unnecessary. And of course, there are the rest of the options listed at https://github.com/Unitech/pm2/#json-app-declaration

With this, it acts a lot like supervisord, monit, and so on. Just start it with pm2 start app.json. and badda-bing, badda-boom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment