Backup automatico script del 2026-07-05 07:00
This commit is contained in:
@@ -20,6 +20,12 @@ EXCLUDED_FILES = {
|
||||
"road_weather.log",
|
||||
"snow_radar.log",
|
||||
}
|
||||
SEASONAL_EXCLUDED_FILES = {
|
||||
"freeze_alert.log",
|
||||
"arome_snow_alert.log",
|
||||
"meteo.log",
|
||||
}
|
||||
SEASONAL_EXCLUDED_MONTHS = {5, 6, 7, 8, 9} # maggio-settembre
|
||||
# Log irrigazione: aggiornato solo quando lo script viene eseguito (cron --auto o /irrigazione).
|
||||
# Se non c’è un cron giornaliero, il file può restare “non aggiornato” per giorni (normale in inverno).
|
||||
STALE_EXCLUDE_BASENAMES = {"irrigation_advisor.log"}
|
||||
@@ -230,7 +236,10 @@ def main():
|
||||
for pat in DEFAULT_PATTERNS:
|
||||
files.extend(sorted([str(p) for p in Path(BASE_DIR).glob(pat)]))
|
||||
files = sorted(set(files))
|
||||
files = [p for p in files if os.path.basename(p) not in EXCLUDED_FILES]
|
||||
now_month = datetime.datetime.now().month
|
||||
seasonal_exclusions = SEASONAL_EXCLUDED_FILES if now_month in SEASONAL_EXCLUDED_MONTHS else set()
|
||||
excluded_names = EXCLUDED_FILES | seasonal_exclusions
|
||||
files = [p for p in files if os.path.basename(p) not in excluded_names]
|
||||
|
||||
since = datetime.datetime.now() - datetime.timedelta(days=args.days)
|
||||
category_hits, per_file_counts, timeout_minutes, stale_logs = analyze_logs(files, since, args.max_lines)
|
||||
|
||||
Reference in New Issue
Block a user