Riorganizzazione Progetto pt.1

This commit is contained in:
marco.locatelli@steamware.net
2024-02-21 10:04:07 +01:00
parent 7ee6e03cbf
commit 236bcf195c
9 changed files with 0 additions and 14 deletions
+20
View File
@@ -0,0 +1,20 @@
$LogPath = "C:\inetpub\logs"
$maxDaystoKeep = -90
$outputPath = "C:\Steamware\Logs\Cleanup_Logs.log"
Write-Output "Start Cleanup" > $outputPath
$itemsToDelete = dir $LogPath -Recurse -File *.log | Where LastWriteTime -lt ((get-date).AddDays($maxDaystoKeep))
if ($itemsToDelete.Count -gt 0){
ForEach ($item in $itemsToDelete){
"$($item.BaseName) is older than $((get-date).AddDays($maxDaystoKeep)) and will be deleted" | Add-Content $outputPath
Remove-Item $item.FullName -Verbose
}
}
ELSE{
"No items to be deleted today $($(Get-Date).DateTime)" | Add-Content $outputPath
}
Write-Output "Cleanup of log files older than $((get-date).AddDays($maxDaystoKeep)) completed..."
start-sleep -Seconds 3
+37
View File
@@ -0,0 +1,37 @@
<#
ESEGUE UNA CHIAMATA A UNA uri e fa il log dei dati restituiti ...
Se tutto Ok scrive un file di check, questo file viene usato per verificare che non sia già stato eseguito in modo corretto nelle
precedenti n. ore, così posso schedularlo più volte
Esegue prima una chiamata ping al server, poi una chiamata a una URL di test e infine la chiamata effettiva
Sarebbe da sistemare e rendere parametrica / procedura ...
# *** NOTE TECNICHE PER SCHEDULAZIONE
# Per far scrivere il ritorno dalla chiamata di IIS nel file di log ho creato la schedulazione entrando con
# l'utente stesso (Steamware) che esegue lo script e ho fatto import della schedulazione ( in ambiente ISE il log lo scrive )
# Ho messo anche permessi all'utente "Logon as batch job" ( vedi sotto )
# Utente messo in PowerUser e permessi scrittura cartella Steamware
# Logon as batch job policy is set for the user. This policy is accessible by opening the Control Panel, Administrative Tools,
# and then Local Security Policy -> Local Policy -> User Rights Assignment -> then Logon as batch job.
# Task Security Context
# https://forsenergy.com/en-us/taskscheduler/html/a922c2b5-6a43-4503-ab7f-4f3d77b3cc8a.htm
# Mod. 2022-05-16 Minor Fix
# Mod. 2022-05-17 Ping e Varie
# Mod. 2022-05-18 add Check ObjTest
#>
Remove-Variable * -ErrorAction SilentlyContinue # pulisco variabili x ISE
$durata = 5
& "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabbix.ufficio -s "IIS04" -k TESTER -o $durata
+4
View File
@@ -0,0 +1,4 @@
@ECHO off
REM Effettua chimata x sync fileUpload da IIS03 a stor01...
ROBOCOPY C:\inetpub\liman.egalware.com\MP\fileUpload "\\stor01\TEAM DRIVES\40_FileUpload\ConfMan.IOB" /MIR