Skip to content

Instantly share code, notes, and snippets.

@pdcastro
Last active July 6, 2019 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdcastro/40f6999c0a6ee08e9ec629a5c167e7bc to your computer and use it in GitHub Desktop.
Save pdcastro/40f6999c0a6ee08e9ec629a5c167e7bc to your computer and use it in GitHub Desktop.
Test SIGTERM
FROM balenalib/%%BALENA_ARCH%%-debian-node:10.16-jessie-build as build
WORKDIR /usr/src/app
COPY . .
# CMD ["npm", "start"]
CMD ["/usr/local/bin/node", "index.js"]
process.on('SIGTERM', () =>
{
console.log('SIGTERM signal received, shutting down…');
// bunch of other de-init code here
process.exit(0);
}
);
function f1() {
console.log('hello world');
}
f1();
const oneHour = 3600000;
setTimeout(f1, oneHour);
{
"name": "test_sigterm",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"private": true,
"dependencies": {
},
"devDependencies": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment