diff --git a/README.md b/README.md index 2fd3b9c..c044f8d 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ forever-service version 0.x.x --logrotateMax [value] Maximum logrotated files to retain, default 10 (logrotate parameter) --logrotateCompress Enable compression for logrotate + --killStartPrefix Force prefix to update-rc.d run levels -p --foreverPath Path for forever cli e.g. /usr/local/bin, by default forever cli is searched in system Path variable diff --git a/bin/forever-service b/bin/forever-service index 6b1d2b8..3de56f8 100755 --- a/bin/forever-service +++ b/bin/forever-service @@ -36,6 +36,7 @@ platforms.get(function(err, platform){ .option('--logrotateCompress', 'Enable compression for logrotate\n') .option('-p --foreverPath [value]','Path for forever cli e.g. /usr/local/bin,\n by default forever cli is searched in system Path variable\n') .option('-u --applyUlimits','Apply increased ulimits in supported environment\n') + .option('--killStartPrefix','Force prefix to update-rc.d run levels. Default is 20\n') .option('-r --runAsUser [user]','*Experimental* Run service as a specific user, defaults to root (No ubuntu support yet)\n') .description( 'Install node script (defaults to app.js in current directory) as service via forever\n\n' @@ -83,6 +84,7 @@ platforms.get(function(err, platform){ if(options.logrotateMax) ctx.logrotateMax = options.logrotateMax; if(options.logrotateCompress) ctx.logrotateCompress = 'compress'; if(options.applyUlimits) ctx.applyUlimits = true; + ctx.killStartPrefix = options.killStartPrefix || 20; ctx.foreverPath=path.dirname(getCmdPath('forever')); if(options.foreverPath) { diff --git a/templates/sysvinit/installer.js b/templates/sysvinit/installer.js index b419fac..77f2879 100644 --- a/templates/sysvinit/installer.js +++ b/templates/sysvinit/installer.js @@ -62,7 +62,7 @@ exports.install=function(ctx, scripts, callback){ function(callback){ var pcmd = 'chkconfig --add '+ctx.service; if(ctx.scmd ==='update-rc.d') - pcmd = '/usr/sbin/update-rc.d '+ctx.service+' defaults'; + pcmd = '/usr/sbin/update-rc.d '+ctx.service+' defaults ' + ctx.killStartPrefix; shell.exec(pcmd, {async: true}, function(code, output){ callback(code != 0?'Could not add service '+ctx.service+'\n'+output:null); //error if non 0 exit code });