Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/post start hook #5706

Open
wants to merge 11 commits into
base: development
Choose a base branch
from
Open

Conversation

dreusel
Copy link

@dreusel dreusel commented Nov 1, 2023

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 pm2-hive/pm2-hive.github.io#250

@CLAassistant
Copy link

CLAassistant commented Nov 1, 2023

CLA assistant check
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.

✅ Unitech
✅ dreusel
❌ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants