Files
cloudron-box/crashnotifierservice.js

23 lines
558 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
'use strict';
2021-08-22 17:14:00 -07:00
const database = require('./src/database.js');
2021-08-22 17:14:00 -07:00
const crashNotifier = require('./src/crashnotifier.js');
// This is triggered by systemd with the crashed unit name as argument
2021-08-22 17:14:00 -07:00
async function main() {
if (process.argv.length !== 3) return console.error('Usage: crashnotifier.js <unitName>');
2021-08-22 17:14:00 -07:00
const unitName = process.argv[2];
console.log('Started crash notifier for', unitName);
2015-09-07 21:10:00 -07:00
// eventlog api needs the db
2021-08-22 17:14:00 -07:00
await database.initialize();
2021-08-22 17:14:00 -07:00
await crashNotifier.sendFailureLogs(unitName);
}
main();