Skip to content

Commit

Permalink
act properly on sigterm and sigkill
Browse files Browse the repository at this point in the history
  • Loading branch information
andibraeu committed Dec 7, 2021
1 parent 681f5b6 commit 5e6a0a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,23 @@ async function main() {
args: chromeArgs,
executablePath: "/usr/bin/chromium-browser",
handleSIGINT: false,
handleSIGTERM: false
});
page = await browser.newPage();

// Manual handling on SIGINT to gracefully hangup and exit
process.on("SIGINT", async () => {
async function shutdown() {
console.log("Exiting...");
await page.close();
//await page.close();
browser.close();
console.log("Done!");
process.exit();
});
}

// Manual handling on SIGINT to gracefully hangup and exit
process.on("SIGINT", shutdown);

// Manual handling on SIGINT to gracefully hangup and exit
process.on("SIGTERM", shutdown);

// Start Jitsi Meet
await page.goto(url);
Expand Down
2 changes: 1 addition & 1 deletion jitsi-headless.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=headless jitsi client
After=network.target
After=network.target picar-control.service

[Service]
Type=simple
Expand Down

0 comments on commit 5e6a0a1

Please sign in to comment.