Skip to content
Snippets Groups Projects
Commit 2a572e5b authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #323 Logs are now equivalent to 'tail' command on the log file

parent 635ca2a5
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
var directory = require('../app/lib/directory'); var directory = require('../app/lib/directory');
var path = require('path'); var path = require('path');
var Tail = require('always-tail');
var daemon = require("daemonize2").setup({ var daemon = require("daemonize2").setup({
main: "ucoind", main: "ucoind",
...@@ -21,16 +20,6 @@ switch (process.argv[2]) { ...@@ -21,16 +20,6 @@ switch (process.argv[2]) {
daemon.stop(); daemon.stop();
break; break;
case "logs":
var tail = new Tail(directory.INSTANCE_HOMELOG_FILE, '\n', {
interval: 5,
start: 0
});
tail.on("line", function(data) {
console.log(data);
});
break;
case "restart": case "restart":
daemon = require("daemonize2").setup({ daemon = require("daemonize2").setup({
main: "ucoind", main: "ucoind",
...@@ -47,6 +36,11 @@ switch (process.argv[2]) { ...@@ -47,6 +36,11 @@ switch (process.argv[2]) {
}); });
break; break;
case "logs":
console.log(directory.INSTANCE_HOMELOG_FILE);
process.exit(0);
break;
default: default:
console.log("Usage: [start|stop|restart]"); console.log("Usage: [start|stop|restart]");
} }
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
"url": "https://github.com/ucoin-io/ucoin/issues" "url": "https://github.com/ucoin-io/ucoin/issues"
}, },
"dependencies": { "dependencies": {
"always-tail": "0.2.0",
"async": "0.2.9", "async": "0.2.9",
"bindings": "1.2.1", "bindings": "1.2.1",
"co": "4.6.0", "co": "4.6.0",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
ucoind() { ucoind() {
local NODE local NODE
local LOGS_FILE
if [ -z "$DEV_MODE" ]; then if [ -z "$DEV_MODE" ]; then
...@@ -35,10 +36,15 @@ ucoind() { ...@@ -35,10 +36,15 @@ ucoind() {
# UCOIN DAEMON MANAGEMENT # UCOIN DAEMON MANAGEMENT
#--------------------------------- #---------------------------------
start|stop|restart|logs) start|stop|restart)
$NODE "$UCOIN_DIR/bin/daemon" $* $NODE "$UCOIN_DIR/bin/daemon" $*
;; ;;
logs)
LOGS_FILE=`$NODE "$UCOIN_DIR/bin/daemon" $*`
tail -f -n 500 "$LOGS_FILE"
;;
#--------------------------------- #---------------------------------
# UCOIN CLI COMMANDS # UCOIN CLI COMMANDS
#--------------------------------- #---------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment