mirror of
https://gitlab.com/octospacc/Configs.git
synced 2025-06-05 21:59:36 +02:00
Auto-Backup $'Thu Oct 03 2024 10:28:15 GMT+0200 (Central European Summer Time)'
This commit is contained in:
@@ -1,17 +1,12 @@
|
|||||||
#!/usr/bin/env zx
|
#!/usr/bin/env zx
|
||||||
|
|
||||||
const BackupsBase = '/Main/Backup';
|
const BackupsBase = '/Main/Backup';
|
||||||
const TimeLimit = [0, 1, 0];
|
const TimeLimit = { years: 0, months: 1, days: 0 };
|
||||||
|
|
||||||
let [year, month, day] = TimeLimit;
|
const maxDate = (new Date());
|
||||||
const maxDate = { year, month, day };
|
maxDate.setDate(maxDate.getDate() - TimeLimit.days);
|
||||||
|
maxDate.setMonth(maxDate.getMonth() - TimeLimit.months);
|
||||||
const nowDate = (new Date());
|
maxDate.setYear(maxDate.getFullYear() - TimeLimit.years);
|
||||||
//const nowDate = {
|
|
||||||
// year: Number(Time.getFullYear()),
|
|
||||||
// month: Number((Time.getMonth() + 1).toString().padStart(2, '0')),
|
|
||||||
// day: Number(Time.getDate().toString().padStart(2, '0')),
|
|
||||||
//};
|
|
||||||
|
|
||||||
cd(BackupsBase);
|
cd(BackupsBase);
|
||||||
const allDirsList = String(await $`ls -d */`).trim().split('\n');
|
const allDirsList = String(await $`ls -d */`).trim().split('\n');
|
||||||
@@ -33,7 +28,10 @@ for (const folder of allDirsList) {
|
|||||||
month = month;
|
month = month;
|
||||||
day = day.split('.')[0];
|
day = day.split('.')[0];
|
||||||
const fileDate = (new Date(`${year}-${month}-${day}`));
|
const fileDate = (new Date(`${year}-${month}-${day}`));
|
||||||
|
if (fileDate > maxDate) {
|
||||||
//$`rm`
|
continue;
|
||||||
|
}
|
||||||
|
console.log(1, file);
|
||||||
|
//await $`rm ${file}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ server {
|
|||||||
error_page 500 = /error.php?code=500;
|
error_page 500 = /error.php?code=500;
|
||||||
access_log /var/log/nginx/root.access.log;
|
access_log /var/log/nginx/root.access.log;
|
||||||
error_log /var/log/nginx/root.error.log;
|
error_log /var/log/nginx/root.error.log;
|
||||||
location / {
|
location / {
|
||||||
root /Main/Server/www/root;
|
root /Main/Server/www/root;
|
||||||
if ($request_uri ~ ^([^.\?]*[^/])$) {
|
if ($request_uri ~ ^([^.\?]*[^/])$) {
|
||||||
return 301 $1/;
|
return 301 $1/;
|
||||||
|
Reference in New Issue
Block a user