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