From f66ca1ac063d6da26015bd1915733cb47286b798 Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Mon, 27 Nov 2017 03:19:16 -0600 Subject: [PATCH] add keepAlive and runAtLoad to configuration object --- lib/daemon.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/daemon.js b/lib/daemon.js index 7514ed7..9cde941 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -124,7 +124,29 @@ var daemon = function(config) { writable: true, configurable: false, value: config.cwd || p.dirname( ( ( this.script === undefined ) || ( this.script === null ) ) ? '' : this.script.toString() ) - }, + }, + + /** + * @cfg {Boolean} [runAtLoad] + * To set the script to run at load. Defaults to true. + */ + runAtLoad: { + enumerable: false, + writable: true, + configurable: false, + value: config.runAtLoad instanceof Boolean ? config.runAtLoad : true + }, + + /** + * @cfg {Boolean} [keepAlive] + * Keep the script running all the time. Defaults to false. + */ + keepAlive: { + enumerable: false, + writable: true, + configurable: false, + value: config.keepAlive instanceof Boolean ? config.keepAlive : false + }, /** * @cfg {Array|Object} [env] @@ -340,9 +362,9 @@ var daemon = function(config) { var tpl = { Label: me.label, ProgramArguments: args, - RunAtLoad: true, + RunAtLoad: me.runAtLoad, //StartInterval: 3600, - KeepAlive: false, + KeepAlive: me.keepAlive, WorkingDirectory: me.cwd, StandardOutPath: me.outlog, StandardErrorPath: me.errlog