初始提交

This commit is contained in:
wanyongkang
2020-10-07 20:25:03 +08:00
commit d318014316
3809 changed files with 263103 additions and 0 deletions

35
script/clearpsiplog.js Normal file
View File

@@ -0,0 +1,35 @@
#! /usr/bin/node
const fs = require('fs');
const dayjs = require('dayjs');
const shell = require('shelljs');
const is_numeric = (value) => {
if (typeof (value) === 'object') {
return false;
} else {
return !Number.isNaN(Number(value));
}
};
const startPath = "/data/docker/applog/psip";
fs.readdirSync(startPath).forEach(item => {
fs.readdirSync(`${startPath}/${item}/Logs`).forEach(logDir => {
if (is_numeric(logDir)) {
var date = dayjs(logDir.toString());
if (date.isBefore(dayjs().subtract(7, 'day'))) {
const deleteDir = `${startPath}/${item}/Logs/${logDir}`;
shell.exec(`rm -rf ${deleteDir}`);
console.log(`删除文件夹${deleteDir}`);
}
}
})
});