mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Merge branch 'master' of https://gitlab.com/YourFriendlyNeighborhoodDealer/question-node-server
This commit is contained in:
commit
f2dbd98f71
7 changed files with 356 additions and 102 deletions
9
utils.js
9
utils.js
|
@ -12,10 +12,10 @@ var fs = require('fs');
|
|||
var logger = require('./logger.js');
|
||||
|
||||
const recievedFile = "stats/recieved";
|
||||
const publicFile = "public/data/public";
|
||||
const staticFile = "public/data/static";
|
||||
const manFile = "public/man.html";
|
||||
const logFile = "stats/logs";
|
||||
const dataFile = "public/data.json";
|
||||
|
||||
function ReadFile(name) {
|
||||
return fs.readFileSync(name, "utf8");
|
||||
|
@ -57,11 +57,12 @@ function WriteBackup() {
|
|||
logger.Log("[ERR ]: Error backing up recieved file!", logger.GetColor("redbg"));
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
try {
|
||||
WriteFileAsync(ReadFile(publicFile), 'public/backs/public_' + new Date().toString());
|
||||
//logger.Log('[SAVE]: Public questions backup wrote');
|
||||
WriteFileAsync(ReadFile(dataFile), 'public/backs/data_' + new Date().toString());
|
||||
|
||||
} catch (e) {
|
||||
logger.Log("[ERR ]: Error backing up public file!", logger.GetColor("redbg"), true);
|
||||
logger.Log("[ERR ]: Error backing up data json file!", logger.GetColor("redbg"));
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue