Skip to content

Commit

Permalink
[enh] #659: cli: add warning lauching sub-cmds using bin/duniter:
Browse files Browse the repository at this point in the history
- sub-commands using daemonizer: webstart, webstop, webrestart, start, stop, restart.
- can't launch this sub-commands using 'bin/duniter'.
- lauch daemon from 'duniter.sh' is required.
  • Loading branch information
M5oul committed Oct 15, 2016
1 parent 255ff6f commit 063adaa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/cli.js
Expand Up @@ -145,7 +145,8 @@ program
program
.command('start')
.description('Start Duniter node daemon.')
.action(subCommand(service((server, conf) => new Promise((resolve, reject) => {
.action(subCommand(needsToBeLaunchedByScript),
subCommand(service((server, conf) => new Promise((resolve, reject) => {
co(function*() {
try {
yield duniter.statics.startNode(server, conf);
Expand All @@ -158,10 +159,12 @@ program
program
.command('stop')
.description('Stop Duniter node daemon.')
.action(subCommand(needsToBeLaunchedByScript));

program
.command('restart')
.description('Restart Duniter node daemon.')
.action(subCommand(needsToBeLaunchedByScript));

program
.command('webwait')
Expand All @@ -176,10 +179,12 @@ program
program
.command('webstop')
.description('Stop Duniter node daemon and web admin.')
.action(subCommand(needsToBeLaunchedByScript));

program
.command('webrestart')
.description('Restart Duniter node daemon and web admin.')
.action(subCommand(needsToBeLaunchedByScript));

program
.command('wizard [step]')
Expand Down Expand Up @@ -924,3 +929,8 @@ function mainError(err) {
logger.error(err.code || err.message || err);
throw Error("Exiting");
}

function needsToBeLaunchedByScript() {
logger.error('This command must not be launched directly, using duniter.sh script');
return Promise.resolve();
}

0 comments on commit 063adaa

Please sign in to comment.