mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
graceful shutdown when listen error
This commit is contained in:
parent
e7cc5340e5
commit
b413427a37
1 changed files with 7 additions and 3 deletions
|
@ -570,15 +570,19 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
|||
|
||||
});
|
||||
|
||||
console.log("Init")
|
||||
server.listen(port, hostname, () => {
|
||||
console.log("Init the server")
|
||||
|
||||
server.once("error", async (err) => {
|
||||
console.error("Cannot listen: " + err.message);
|
||||
await Database.close();
|
||||
});
|
||||
|
||||
server.listen(port, hostname, () => {
|
||||
if (hostname) {
|
||||
console.log(`Listening on ${hostname}:${port}`);
|
||||
} else {
|
||||
console.log("Listening on ${port}");
|
||||
}
|
||||
|
||||
startMonitors();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue