From c193379dbadda429071c566fedf3f8423e23a3a3 Mon Sep 17 00:00:00 2001 From: Satinder Grewal Date: Sun, 15 Jan 2017 05:30:35 +1300 Subject: [PATCH] check file exists function added --- routes/shepherd.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/routes/shepherd.js b/routes/shepherd.js index 9638575..7d62392 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -220,6 +220,12 @@ function setConf(flock) { } console.log(DaemonConfPath); + + var CheckFileExists = function() { + fs.ensureFile(DaemonConfPath, function (err) { + console.log(err) // => null + }) + } var RemoveLines = function() { @@ -247,7 +253,7 @@ function setConf(flock) { var result = 'CheckConf is done' setconf.status(DaemonConfPath, function(err, status) { - //console.log(status[0]); + console.log(status[0]); //console.log(status[0].rpcuser); var rpcuser = function() { @@ -349,10 +355,11 @@ function setConf(flock) { }) } - RemoveLines() + CheckFileExists() .then(function(result) { - return CheckConf(); + return RemoveLines(); }) + .then(CheckConf) }