pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

Question: Can PM2 send notifications or launch an arbitrary script when a process dies?

Open cosmicscr opened this issue 9 years ago • 2 comments

Hi, I've been googling around, looking through pm2 docs, and looking through github issues but can't seem to find an answer to this question:

Is there a way for pm2 to launch an arbitrary script when a process that it is monitoring crashes? I understand that pm2 can automatically restart the process, but can it also launch a script?

The purpose is for notifications. When a process dies in production, what is the best practice way of sending alerts or notifications using pm2?

Thanks for any advice!

cosmicscr avatar Mar 16 '17 17:03 cosmicscr

Two solutions :

  • use https://keymetrics.io
  • or make a module that listen event from the bus and then do whatever you want.

vmarchaud avatar Mar 16 '17 17:03 vmarchaud

Just to clarify, it appears the free tier of keymetrics does not support any notifications, so it requires a minimum of $360/yr to use keymetrics to add notifications.

psifertex avatar Apr 07 '18 17:04 psifertex