mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
22 lines
328 B
JavaScript
22 lines
328 B
JavaScript
|
|
var stopped = false;
|
|
|
|
function work() {
|
|
console.log('working');
|
|
!stopped && setTimeout(work, 1000);
|
|
}
|
|
|
|
function stop() {
|
|
console.log('shutting down');
|
|
stopped = true;
|
|
}
|
|
|
|
process.once('SIGINT', stop); // CTRL-C
|
|
|
|
process.on('beforeExit', function() {
|
|
console.log('exited cleanly :)');
|
|
process.exit(0);
|
|
});
|
|
|
|
work();
|