forked from mirrors/amnezia-wg-easy
feat: support graceful shutdown
This commit is contained in:
parent
f603d6b5da
commit
6604e44ea3
3 changed files with 22 additions and 1 deletions
|
@ -12,3 +12,15 @@ WireGuard.getConfig()
|
|||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// Handle terminate signal
|
||||
process.on('SIGTERM', async() => {
|
||||
console.log('SIGTERM signal received.');
|
||||
await WireGuard.Shutdown();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Handle interupt signal
|
||||
process.on('SIGINT', () => {
|
||||
console.log('SIGINT signal received.');
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue