pm2
pm2 copied to clipboard
Feat/post start hook
This introduces the option to configure a post-start-hook for apps. The hook should be implemented in the form of a js file where the main export is the function taking an info object and callback as its parameters:
module.exports = function hook(info, cb) {
cb(null);
};
This function will be invoked after the app has been (re)started. The info
object contains useful things for knowing about / interacting with the newly running app instance:
- {string} info.pid The apps PID
- {Stream} info.stdin The apps STDIN stream
- {Stream} info.stdout The apps STDOUT stream
- {Stream} info.stderr The apps STDERR stream
- {object} pm2_env The apps environment
The hook can be enabled by adding a post_start_hook
field to the app configuration blob, for example:
- name: app
script: app.js
post_start_hook: post-start-hook.js
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #5705 |
License | MIT |
Doc PR | https://github.com/pm2-hive/pm2-hive.github.io/pull/250 |
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.
:white_check_mark: Unitech
:white_check_mark: dreusel
:x: Your Name
Your Name seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.