Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-rc.d prefix #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions bin/forever-service
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion templates/sysvinit/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down