* Get list of all processes managed * * @param {Function} cb Callback
(opts, cb)
| 588 | * @param {Function} cb Callback |
| 589 | */ |
| 590 | list (opts, cb) { |
| 591 | var that = this; |
| 592 | |
| 593 | if (typeof(opts) == 'function') { |
| 594 | cb = opts; |
| 595 | opts = null; |
| 596 | } |
| 597 | |
| 598 | that.Client.executeRemote('getMonitorData', {}, function(err, list) { |
| 599 | if (err) { |
| 600 | Common.printError(err); |
| 601 | return cb ? cb(Common.retErr(err)) : that.exitCli(conf.ERROR_EXIT); |
| 602 | } |
| 603 | |
| 604 | if (opts && opts.rawArgs && opts.rawArgs.indexOf('--watch') > -1) { |
| 605 | var dayjs = require('dayjs'); |
| 606 | function show() { |
| 607 | process.stdout.write('\x1b[2J'); |
| 608 | process.stdout.write('\x1b[0f'); |
| 609 | console.log('Last refresh: ', dayjs().format()); |
| 610 | that.Client.executeRemote('getMonitorData', {}, function(err, list) { |
| 611 | UX.list(list, null); |
| 612 | }); |
| 613 | } |
| 614 | |
| 615 | show(); |
| 616 | setInterval(show, 900); |
| 617 | return false; |
| 618 | } |
| 619 | |
| 620 | return cb ? cb(null, list) : that.speedList(null); |
| 621 | }); |
| 622 | } |
| 623 | |
| 624 | /** |
| 625 | * Kill Daemon |
no test coverage detected