Auto-Backup $'Thu Oct 03 2024 10:28:15 GMT+0200 (Central European Summer Time)'

This commit is contained in:
octospacc 2024-10-03 10:51:58 +02:00
parent 115d90f91e
commit 4a9e18e731
2 changed files with 14 additions and 16 deletions

View File

@ -1,17 +1,12 @@
#!/usr/bin/env zx
const BackupsBase = '/Main/Backup';
const TimeLimit = [0, 1, 0];
const TimeLimit = { years: 0, months: 1, days: 0 };
let [year, month, day] = TimeLimit;
const maxDate = { year, month, day };
const nowDate = (new Date());
//const nowDate = {
// year: Number(Time.getFullYear()),
// month: Number((Time.getMonth() + 1).toString().padStart(2, '0')),
// day: Number(Time.getDate().toString().padStart(2, '0')),
//};
const maxDate = (new Date());
maxDate.setDate(maxDate.getDate() - TimeLimit.days);
maxDate.setMonth(maxDate.getMonth() - TimeLimit.months);
maxDate.setYear(maxDate.getFullYear() - TimeLimit.years);
cd(BackupsBase);
const allDirsList = String(await $`ls -d */`).trim().split('\n');
@ -33,7 +28,10 @@ for (const folder of allDirsList) {
month = month;
day = day.split('.')[0];
const fileDate = (new Date(`${year}-${month}-${day}`));
//$`rm`
if (fileDate > maxDate) {
continue;
}
console.log(1, file);
//await $`rm ${file}`;
}
}

View File

@ -16,7 +16,7 @@ server {
error_page 500 = /error.php?code=500;
access_log /var/log/nginx/root.access.log;
error_log /var/log/nginx/root.error.log;
location / {
location / {
root /Main/Server/www/root;
if ($request_uri ~ ^([^.\?]*[^/])$) {
return 301 $1/;
@ -40,13 +40,13 @@ server {
listen 443 ssl;
server_name hlb0.octt.eu.org;
ssl_certificate /etc/letsencrypt/live/hlb0.octt.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hlb0.octt.eu.org/privkey.pem;
ssl_certificate_key /etc/letsencrypt/live/hlb0.octt.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
error_page 403 = /error.php?code=403;
error_page 404 = /error.php?code=404;
error_page 500 = /error.php?code=500;
access_log /var/log/nginx/root.access.log;
error_log /var/log/nginx/root.error.log;
access_log /var/log/nginx/root.access.log;
error_log /var/log/nginx/root.error.log;
sub_filter '</body>' '<script>top.postMessage(location.href.slice(location.origin.length), "https://hlb0it.blogspot.com")</script></body>';
#sub_filter_once off;