Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect restart of the app by Forever module

Tags:

node.js

I have an application with cluster and Forever. I want to save information from workers before shutdown or restart of the app. So I use process.on('SIGINT') and that works fine for CTRL+C.

But I have stuck with Forever. Is it possible to detect somehow the app was restarted by Forever? Is there any signal about that?

like image 600
Sergey R. Avatar asked Oct 21 '22 12:10

Sergey R.


1 Answers

This issue is quite old, but for those who did not saw it, the lastest forever versions support --killSignal (this has been added in dec 2013) so you can use by example --killSignal=SIGUSR2 and catch this signal with process.on('SIGUSR2', func)

like image 62
bumpmann Avatar answered Oct 24 '22 05:10

bumpmann