rebuzzer
Version:
Rebuzzer is a fullscreen button in the browser which executes a command on the server by clicking on it
27 lines (23 loc) • 543 B
JavaScript
const thing = process.argv[2] ? process.argv[2] : 'apples'
const shutdownDelay = process.argv[3] ? process.argv[3] : 1000
var shutdownRequested = false
var counter = 0
process.on('SIGTERM', function() {
shutdownRequested = true
console.log('TERMINATION REQUESTED')
setTimeout(function() {
console.log('TERMINATE NOW')
process.exit(0)
}, shutdownDelay)
})
function count() {
if(shutdownRequested) {
return
}
++counter
console.log(counter, thing)
setTimeout(function() {
count()
}, 1000)
}
count()