2018-06-03 19:38:40 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2022-01-13 16:25:43 -08:00
|
|
|
const server = require('./server.js');
|
2018-06-03 19:38:40 +02:00
|
|
|
|
2018-06-11 22:51:40 -07:00
|
|
|
const argv = require('yargs')
|
|
|
|
|
.default('port', 2514, 'The port to listen on') // syslog is 514 so we prefix with 2
|
|
|
|
|
.default('logdir', '/tmp/logs', 'The root log directory')
|
|
|
|
|
.argv;
|
2018-06-03 19:38:40 +02:00
|
|
|
|
2018-06-25 00:28:42 +02:00
|
|
|
const options = {
|
|
|
|
|
logFolder: argv.logdir,
|
|
|
|
|
port: argv.port
|
|
|
|
|
};
|
2018-06-03 20:47:26 +02:00
|
|
|
|
|
|
|
|
if (argv.version) {
|
2018-06-11 22:41:12 -07:00
|
|
|
console.log('1.0.1');
|
2018-06-03 20:47:26 +02:00
|
|
|
process.exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-03 19:38:40 +02:00
|
|
|
console.log();
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
console.log(' Cloudron Syslog Daemon ');
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
console.log();
|
2018-06-25 00:28:42 +02:00
|
|
|
console.log(' Log Folder: ', options.logFolder);
|
|
|
|
|
console.log(' UDP Port: ', options.port);
|
2018-06-03 19:38:40 +02:00
|
|
|
console.log();
|
|
|
|
|
console.log('==========================================');
|
|
|
|
|
console.log();
|
|
|
|
|
|
2018-06-25 00:28:42 +02:00
|
|
|
server.start(options, function (error) {
|
|
|
|
|
if (error) return console.error(error);
|
2018-06-03 19:38:40 +02:00
|
|
|
console.log('Listening...');
|
2018-06-25 00:28:42 +02:00
|
|
|
});
|