updated program data folders creation
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var datadefinition;
|
var datadefinition;
|
||||||
var filepath;
|
var filepath;
|
||||||
var counterpath;
|
|
||||||
var data = {};
|
var data = {};
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
bite_size = 4096,
|
bite_size = 4096,
|
||||||
@@ -11,14 +10,17 @@ var fs = require('fs'),
|
|||||||
fd;
|
fd;
|
||||||
|
|
||||||
function init(file,logic,idle){
|
function init(file,logic,idle){
|
||||||
|
var counterpath;
|
||||||
|
|
||||||
delete require.cache[require.resolve('../../config/fromlog/datadefinitions/' + logic)];
|
delete require.cache[require.resolve('../../config/fromlog/datadefinitions/' + logic)];
|
||||||
datadefinition = require('../../config/fromlog/datadefinitions/' + logic);
|
datadefinition = require('../../config/fromlog/datadefinitions/' + logic);
|
||||||
|
|
||||||
save_interval_or_retry = idle;
|
save_interval_or_retry = idle;
|
||||||
|
|
||||||
filepath = path.resolve(__dirname, '../../config/fromlog/logs/' + file);
|
filepath = path.resolve(__dirname, '../../config/fromlog/logs/' + file);
|
||||||
|
counterpath = path.resolve(__dirname, '../../program-data/fromlog/counters/' + file);
|
||||||
|
|
||||||
fs.readFile(filepath,function(err, content){
|
fs.readFile(counterpath,function(err, content){
|
||||||
if (err){
|
if (err){
|
||||||
filereadbytes = 0;
|
filereadbytes = 0;
|
||||||
}else{
|
}else{
|
||||||
@@ -30,8 +32,9 @@ function init(file,logic,idle){
|
|||||||
var oldfilereadbytes = filereadbytes;
|
var oldfilereadbytes = filereadbytes;
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
if (filereadbytes != oldfilereadbytes){
|
if (filereadbytes != oldfilereadbytes){
|
||||||
counterpath = path.resolve(__dirname, '../../program-data/fromlog/counters/' + file);
|
fs.mkdir(path.resolve(__dirname, '../../program-data/fromlog/counters'), { recursive: true }, (err) => {
|
||||||
fs.writeFile(counterpath, filereadbytes.toString(),function(err){});
|
fs.writeFile(counterpath, filereadbytes.toString(),function(err){});
|
||||||
|
});
|
||||||
oldfilereadbytes = filereadbytes;
|
oldfilereadbytes = filereadbytes;
|
||||||
}
|
}
|
||||||
}, save_interval_or_retry);
|
}, save_interval_or_retry);
|
||||||
|
|||||||
Reference in New Issue
Block a user