Select Git revision
CHANGELOG.md
Forked from
nodes / typescript / duniter
Source project has a limited visibility.
To find the state of this project's repository at the time of any of these versions, check out the tags.
daemon 1.06 KiB
#!/usr/bin/env node
"use strict";
var directory = require('../app/lib/directory');
var path = require('path');
var daemon = require("daemonize2").setup({
main: "ucoind",
name: directory.INSTANCE_NAME,
pidfile: path.join(directory.INSTANCE_HOME, "app.pid")
});
switch (process.argv[2]) {
case "start":
daemon.start();
break;
case "stop":
daemon.stop();
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();
});
break;
case "logs":
console.log(directory.INSTANCE_HOMELOG_FILE);
process.exit(0);
break;
default:
console.log("Usage: [start|stop|restart]");
}