You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
540 B
28 lines
540 B
6 years ago
|
if (process.argv.length<3) {
|
||
|
console.log('Call: test_upsvars.js <ip> <port> <ups-name>');
|
||
|
process.exit();
|
||
|
}
|
||
|
|
||
|
var Nut = require('node-nut');
|
||
|
|
||
|
//oNut = new Nut(3493, 'localhost');
|
||
|
oNut = new Nut(process.argv[3], process.argv[2]);
|
||
|
|
||
|
oNut.on('error', function(err) {
|
||
|
console.log('There was an error: ' + err);
|
||
|
});
|
||
|
|
||
|
oNut.on('close', function() {
|
||
|
console.log('Connection closed.');
|
||
|
});
|
||
|
|
||
|
oNut.on('ready', function() {
|
||
|
self = this;
|
||
|
this.GetUPSList(function(upslist) {
|
||
|
console.log(upslist);
|
||
|
self.close();
|
||
|
});
|
||
|
});
|
||
|
|
||
|
oNut.start();
|