From 9a073fafd41b2ac5e2224da2b516f389566a336f Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Fri, 7 May 2021 08:29:01 +0200 Subject: [PATCH] logs Ordner erstellen --- fileserver-hdds-alles.ps1 | 10 +++++++++- fileserver-hdds-videos.ps1 | 7 ++++++- laptop-ssd.ps1 | 5 +++++ nas_papa-hdds.ps1 | 7 +++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/fileserver-hdds-alles.ps1 b/fileserver-hdds-alles.ps1 index c473dcc..9ae931e 100644 --- a/fileserver-hdds-alles.ps1 +++ b/fileserver-hdds-alles.ps1 @@ -13,10 +13,11 @@ function get-timestamp{ # restliche Variablen $timestamp = get-timestamp # Ruft Funktion get-timestamp auf $scriptpfad = Get-ScriptDirectory # setzt $scriptpfad auf den Wert von Get-ScriptDirectory -# Hhostname +# Hostname $hostname_ist = $env:computername $hostname_soll = "irantu" + # Ziele/Quellen $quelle1 ="\\fileserver2.grote.lan\mg" $quelle2 ="\\fileserver2.grote.lan\Musik" @@ -55,6 +56,13 @@ if ($hostname_ist -eq $hostname_soll) Exit 1 } +# logs Ordner erstellen +If(!(test-path $scriptpfad\logs)) +{ + New-Item -ItemType Directory -Force -Path $scriptpfad\logs +} + + robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" /XD "\\fileserver2.grote.lan\mg\Programme\Spiele - nicht gesichert" robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log" robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log" diff --git a/fileserver-hdds-videos.ps1 b/fileserver-hdds-videos.ps1 index 874ce36..043ced4 100644 --- a/fileserver-hdds-videos.ps1 +++ b/fileserver-hdds-videos.ps1 @@ -35,5 +35,10 @@ if ($hostname_ist -eq $hostname_soll) Exit 1 } -robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" +# logs Ordner erstellen +If(!(test-path $scriptpfad\logs)) +{ + New-Item -ItemType Directory -Force -Path $scriptpfad\logs +} +robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" diff --git a/laptop-ssd.ps1 b/laptop-ssd.ps1 index 256cdac..8cc2713 100644 --- a/laptop-ssd.ps1 +++ b/laptop-ssd.ps1 @@ -39,6 +39,11 @@ if ($hostname_ist -eq $hostname_soll) Exit 1 } +# logs Ordner erstellen +If(!(test-path $scriptpfad\logs)) +{ + New-Item -ItemType Directory -Force -Path $scriptpfad\logs +} robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log" diff --git a/nas_papa-hdds.ps1 b/nas_papa-hdds.ps1 index 00f2fcf..631eaa5 100644 --- a/nas_papa-hdds.ps1 +++ b/nas_papa-hdds.ps1 @@ -37,6 +37,7 @@ $ziel4="$scriptpfad\backup\musik" $ziel5="$scriptpfad\backup\videos" $ziel6="$scriptpfad\backup\rest" + # Hostname prüfen if ($hostname_ist -eq $hostname_soll) { @@ -49,6 +50,12 @@ if ($hostname_ist -eq $hostname_soll) Exit 1 } +# logs Ordner erstellen +If(!(test-path $scriptpfad\logs)) +{ + New-Item -ItemType Directory -Force -Path $scriptpfad\logs +} + robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" /XD $quelle1\@recycle $quelle1\@Recently-Snapshot robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log" /XD $quelle2\@recycle $quelle2\@Recently-Snapshot robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log" /XD $quelle3\@recycle $quelle3\@Recently-Snapshot