Skip to content

Commit

Permalink
Fix #304 Restart was not working
Browse files Browse the repository at this point in the history
  • Loading branch information
c-geek committed Jan 12, 2016
1 parent 2e1f4e5 commit b56ea74
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/daemon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
var directory = require('../app/lib/directory');
var path = require('path');
var Tail = require('always-tail');
var fs = require('fs');
var util = require('util');

var daemon = require("daemonize2").setup({
main: "ucoind",
Expand Down Expand Up @@ -34,6 +32,15 @@ switch (process.argv[2]) {
break;

case "restart":
daemon = require("daemonize2").setup({
main: "ucoind",
name: directory.INSTANCE_NAME,
pidfile: path.join(directory.INSTANCE_HOME, "app.pid"),

// We must redefine the main argument to 'start' because uCoin will receive it as command argument and does not
// know about 'restart' command.
argv: process.argv.slice(2).map((arg, index) => index == 0 ? 'start' : arg)
});
daemon.stop(function(err) {
err && console.error(err);
daemon.start();
Expand Down

0 comments on commit b56ea74

Please sign in to comment.