From 0d92abb61fc0cb256b8437aaef5e2fc888ea64f4 Mon Sep 17 00:00:00 2001 From: tknew2 Date: Wed, 14 May 2014 14:57:06 +0200 Subject: [PATCH] unify unique id --- lib/WatchDog.js | 2 +- scripts/install.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/WatchDog.js b/lib/WatchDog.js index 0c8f154c..81e283ad 100644 --- a/lib/WatchDog.js +++ b/lib/WatchDog.js @@ -23,7 +23,7 @@ function generateId() { var crypto = require('crypto'); var os = require('os'); - var parts = [os.hostname(), process.pid, +(new Date)]; + var parts = [os.hostname(), JSON.stringify(os.networkInterfaces)]; var hash = crypto.createHash('md5').update(parts.join('')); return hash.digest('hex'); } diff --git a/scripts/install.js b/scripts/install.js index 9790a844..ee194751 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -4,6 +4,10 @@ var WatchDog = require('../lib/WatchDog.js'); var fs = require('fs'); var cst = require('../constants.js'); +if (fs.existsSync(cst.WATCHDOG_FILE)) { + process.exit(0); +} + (function pre_init() { fs.exists(cst.DEFAULT_FILE_PATH, function(exist) { if (!exist) {