Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
11dca3cc
Commit
11dca3cc
authored
8 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix #618 When making a `reset` or `sync`, automatically stop the node if it is currently running
parent
665bfa99
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/cli.js
+1
-20
1 addition, 20 deletions
app/cli.js
bin/daemon
+21
-0
21 additions, 0 deletions
bin/daemon
duniter.sh
+1
-1
1 addition, 1 deletion
duniter.sh
with
23 additions
and
21 deletions
app/cli.js
+
1
−
20
View file @
11dca3cc
...
...
@@ -452,17 +452,10 @@ program
.
command
(
'
check-config
'
)
.
description
(
'
Checks the node
\'
s configuration
'
)
.
action
(
subCommand
(
service
(
function
(
server
)
{
server
.
checkConfig
()
return
server
.
checkConfig
()
.
then
(
function
()
{
logger
.
warn
(
'
Configuration seems correct.
'
);
server
.
disconnect
();
throw
Error
(
"
Exiting
"
);
})
.
catch
(
function
(
err
)
{
logger
.
warn
(
err
.
message
||
err
);
server
.
disconnect
();
throw
Error
(
"
Exiting
"
);
});
})));
program
...
...
@@ -522,7 +515,6 @@ program
}
catch
(
e
)
{
logger
.
error
(
e
);
}
return
server
.
disconnect
();
});
},
type
!=
'
peers
'
)(
type
);
}));
...
...
@@ -830,17 +822,6 @@ function service(callback, nologs) {
};
}
function
logIfErrorAndExit
(
server
,
prefix
)
{
return
function
(
err
)
{
if
(
err
&&
err
.
uerr
)
{
err
=
err
.
uerr
.
message
;
}
err
&&
logger
.
error
((
prefix
?
prefix
:
""
)
+
(
err
.
message
||
err
));
server
.
disconnect
();
onResolve
&&
onResolve
();
};
}
function
parsePercent
(
s
)
{
var
f
=
parseFloat
(
s
);
return
isNaN
(
f
)
?
0
:
f
;
...
...
This diff is collapsed.
Click to expand it.
bin/daemon
+
21
−
0
View file @
11dca3cc
...
...
@@ -17,6 +17,19 @@ switch (process.argv[2]) {
daemon
.
stop
();
break
;
case
"
sync
"
:
case
"
reset
"
:
const
command
=
process
.
argv
[
2
];
if
(
daemon
.
status
())
{
console
.
log
(
'
Stopping daemon...
'
);
daemon
.
stop
(
function
()
{
launchCmd
(
command
);
});
}
else
{
launchCmd
(
command
);
}
break
;
case
"
restart
"
:
daemon
=
getDaemon
(
'
start
'
);
daemon
.
stop
(
function
(
err
)
{
...
...
@@ -78,6 +91,14 @@ function getFullCommand(overrideCommand) {
return
[
duniter
].
concat
(
getCommand
(
overrideCommand
));
}
function
launchCmd
(
cmd
)
{
let
checkConf
=
spawn
(
process
.
argv
[
0
],
getFullCommand
(
cmd
));
// Error messages
checkConf
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
console
.
log
(
data
.
toString
(
'
utf8
'
)));
checkConf
.
stderr
.
on
(
'
data
'
,
(
data
)
=>
console
.
error
(
data
.
toString
(
'
utf8
'
)));
}
function
start
(
daemonToStart
)
{
let
checkConf
=
spawn
(
process
.
argv
[
0
],
getFullCommand
(
'
check-config
'
));
let
echos
=
[];
...
...
This diff is collapsed.
Click to expand it.
duniter.sh
+
1
−
1
View file @
11dca3cc
...
...
@@ -45,7 +45,7 @@ duniter() {
# DUNITER DAEMON MANAGEMENT
#---------------------------------
webwait|webstart|webstop|webrestart|start|stop|restart
)
reset|
webwait|webstart|webstop|webrestart|start|stop|restart
)
$NODE
"
$DUNITER_DIR
/bin/daemon"
$*
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment