Merge pull request 'ueberarbeitung' (#1) from ueberarbeitung into master
Reviewed-on: #1
This commit is contained in:
commit
d9969f40fb
12 changed files with 145 additions and 258 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1 @@
|
||||||
*password.txt*
|
*password.txt*
|
||||||
*.exe
|
|
|
@ -6,13 +6,13 @@ function Get-ScriptDirectory {
|
||||||
$scriptpfad = Get-ScriptDirectory
|
$scriptpfad = Get-ScriptDirectory
|
||||||
#restic variablen
|
#restic variablen
|
||||||
### pfad zu restic, wird mit & $pfad aufgerufen
|
### pfad zu restic, wird mit & $pfad aufgerufen
|
||||||
$pfad="C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe"
|
$pfad="C:\Users\mg\Desktop\NextCloud\code\restic\bin\restic.exe"
|
||||||
### repository
|
### repository
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
$repository="\\fileserver2.grote.lan\backup\restic"
|
||||||
### passwordfile
|
### passwordfile
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
$passwordfile="C:\Users\mg\Desktop\NextCloud\code\restic\config\password.txt"
|
||||||
### exclude file
|
### exclude file
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
$excludefile="C:\Users\mg\Desktop\NextCloud\code\restic\config\exclude.txt"
|
||||||
|
|
||||||
#ausgabe der varriablen und einfaerben der werte mit -foregroundcolor
|
#ausgabe der varriablen und einfaerben der werte mit -foregroundcolor
|
||||||
#`n ist zeilenumbruch
|
#`n ist zeilenumbruch
|
||||||
|
|
BIN
aufgabenplanung/frida.xml
Normal file
BIN
aufgabenplanung/frida.xml
Normal file
Binary file not shown.
Binary file not shown.
BIN
aufgabenplanung/win10.xml
Normal file
BIN
aufgabenplanung/win10.xml
Normal file
Binary file not shown.
|
@ -1,46 +0,0 @@
|
||||||
#Variablen
|
|
||||||
#Variablen setzen
|
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
|
||||||
Split-Path $Invocation.MyCommand.Path
|
|
||||||
}
|
|
||||||
#funktion an variable zuweisen
|
|
||||||
$scriptpfad = Get-ScriptDirectory
|
|
||||||
#hostname
|
|
||||||
$hostname_ist = $env:computername
|
|
||||||
$hostname_soll = "ada"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\Portabel"
|
|
||||||
$ordner2="C:\Users\mg\Desktop"
|
|
||||||
$ordner3="C:\Users\mg\AppData\Roaming\StardewValley"
|
|
||||||
$ordner4=""
|
|
||||||
$ordner5=""
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
|
||||||
start-sleep 5
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
|
|
@ -1,47 +1,58 @@
|
||||||
#Variablen
|
############################# Funktionen #####################################
|
||||||
#Variablen setzen
|
# Setze Scriptpfad
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
function Get-ScriptDirectory {
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
||||||
Split-Path $Invocation.MyCommand.Path
|
Split-Path $Invocation.MyCommand.Path
|
||||||
}
|
}
|
||||||
#funktion an variable zuweisen
|
# Setze Timestamp
|
||||||
$scriptpfad = Get-ScriptDirectory
|
function get-timestamp{
|
||||||
#hostname
|
$timestamp = (get-date -Format yyyy_MM_dd__HH_mm_ss)
|
||||||
$hostname_ist = $env:computername
|
return $timestamp
|
||||||
$hostname_soll = "frida"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\1_Projekte"
|
|
||||||
$ordner2="C:\2_Sonstiges"
|
|
||||||
$ordner3="C:\3_Bewerbung"
|
|
||||||
$ordner4="C:\4_Rezepte"
|
|
||||||
$ordner5="C:\5_Zeitschriften"
|
|
||||||
$ordner6="C:\Users\Anne-"
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
}
|
||||||
else
|
# Funktion: countdown, zählt von einem Wert herunter bis 0
|
||||||
{
|
# der Wert $laufzeit muss übergeben werden, muss int sein, gibt länge des Countdowns an
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
# Bsp.: set-countdown -laufzeit $zeit_countdown oder set-countdown -laufzeit 5
|
||||||
start-sleep 5
|
function set-countdown([int]$laufzeit){
|
||||||
|
for ($laufzeit; $laufzeit -gt 0; $laufzeit--){
|
||||||
|
Start-Sleep -s 1 # wartet 1 Sekunde
|
||||||
|
write-host -ForegroundColor RED $laufzeit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################ Variablen ###################################
|
||||||
|
$scriptpfad = Get-ScriptDirectory # setzt den Pfad zum Script ohne endendes \
|
||||||
|
$timestamp = get-timestamp # setzt den Zeitstempel
|
||||||
|
$hostname_ist = $env:computername # ist-hostname
|
||||||
|
$hostname_soll = "frida" # soll-hostname
|
||||||
|
$restic_logfile_dir="\\fileserver2.grote.lan\backup\restic\logs" # ordner fur die logs
|
||||||
|
$restic_logfile_name=-join($hostname_ist,"_",$timestamp,".log") # definiere logfile-dateiname
|
||||||
|
$restic_repository="\\fileserver2.grote.lan\backup\restic" # restic repo
|
||||||
|
$restic_backupdir1="C:\1_Projekte"
|
||||||
|
$restic_backupdir2="C:\2_Sonstiges"
|
||||||
|
$restic_backupdir3="C:\3_Bewerbung"
|
||||||
|
$restic_backupdir4="C:\4_Rezepte"
|
||||||
|
$restic_backupdir5="C:\5_Zeitschriften"
|
||||||
|
$restic_backupdir6="C:\Users\Anne-"
|
||||||
|
$restic_path= Join-Path $scriptpfad bin\restic.exe
|
||||||
|
|
||||||
|
################################ Logik #######################################
|
||||||
|
if ($hostname_ist -eq $hostname_soll){
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup laeuft..."
|
||||||
|
& $restic_path --cleanup-cache --repo $restic_repository --password-file $scriptpfad\config\password.txt backup --exclude-file $scriptpfad\config\exclude.txt $restic_backupdir1 $restic_backupdir2 $restic_backupdir3 $restic_backupdir4 $restic_backupdir5 $restic_backupdir6 2>&1> $restic_logfile_dir\$restic_logfile_name
|
||||||
|
|
||||||
|
if (($LastExitCode -eq 0) -or ($LastExitCode -eq 3)){ #3 besagt das bestimmte Dateien nicht geoeffnet werden konnten
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup erfolgreich"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Es sind Fehler aufgetreten.`nBitte Log($restic_logfile_dir\$restic_logfile_name) pruefen!"
|
||||||
|
set-countdown -laufzeit 120 # ruft Funktion Countdown auf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Falscher Host(SOLL: $hostname_soll IST: $hostname_ist)"
|
||||||
|
Write-Host -ForegroundColor RED "Bitte den richtigen Host auswaehlen."
|
||||||
|
|
||||||
|
set-countdown -laufzeit 15 # ruft Funktion Countdown auf
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5 $ordner6
|
|
||||||
|
|
|
@ -1,46 +1,54 @@
|
||||||
#Variablen
|
############################# Funktionen #####################################
|
||||||
#Variablen setzen
|
# Setze Scriptpfad
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
function Get-ScriptDirectory {
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
||||||
Split-Path $Invocation.MyCommand.Path
|
Split-Path $Invocation.MyCommand.Path
|
||||||
}
|
}
|
||||||
#funktion an variable zuweisen
|
# Setze Timestamp
|
||||||
$scriptpfad = Get-ScriptDirectory
|
function get-timestamp{
|
||||||
#hostname
|
$timestamp = (get-date -Format yyyy_MM_dd__HH_mm_ss)
|
||||||
$hostname_ist = $env:computername
|
return $timestamp
|
||||||
$hostname_soll = "irantu"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\Users\mg"
|
|
||||||
$ordner2="C:\Portable_Programme"
|
|
||||||
$ordner3=""
|
|
||||||
$ordner4=""
|
|
||||||
$ordner5=""
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
}
|
||||||
else
|
# Funktion: countdown, zählt von einem Wert herunter bis 0
|
||||||
{
|
# der Wert $laufzeit muss übergeben werden, muss int sein, gibt länge des Countdowns an
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
# Bsp.: set-countdown -laufzeit $zeit_countdown oder set-countdown -laufzeit 5
|
||||||
start-sleep 5
|
function set-countdown([int]$laufzeit){
|
||||||
|
for ($laufzeit; $laufzeit -gt 0; $laufzeit--){
|
||||||
|
Start-Sleep -s 1 # wartet 1 Sekunde
|
||||||
|
write-host -ForegroundColor RED $laufzeit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################ Variablen ###################################
|
||||||
|
$scriptpfad = Get-ScriptDirectory # setzt den Pfad zum Script ohne endendes \
|
||||||
|
$timestamp = get-timestamp # setzt den Zeitstempel
|
||||||
|
$hostname_ist = $env:computername # ist-hostname
|
||||||
|
$hostname_soll = "irantu" # soll-hostname
|
||||||
|
$restic_logfile_dir="\\fileserver2.grote.lan\backup\restic\logs" # ordner fur die logs
|
||||||
|
$restic_logfile_name=-join($hostname_ist,"_",$timestamp,".log") # definiere logfile-dateiname
|
||||||
|
$restic_repository="\\fileserver2.grote.lan\backup\restic" # restic repo
|
||||||
|
$restic_backupdir1="C:\Users\mg"
|
||||||
|
$restic_backupdir2="C:\Portable_Programme"
|
||||||
|
$restic_path= Join-Path $scriptpfad bin\restic.exe
|
||||||
|
|
||||||
|
################################ Logik #######################################
|
||||||
|
if ($hostname_ist -eq $hostname_soll){
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup laeuft..."
|
||||||
|
& $restic_path --cleanup-cache --repo $restic_repository --password-file $scriptpfad\config\password.txt backup --exclude-file $scriptpfad\config\exclude.txt $restic_backupdir1 $restic_backupdir2 2>&1> $restic_logfile_dir\$restic_logfile_name
|
||||||
|
|
||||||
|
if (($LastExitCode -eq 0) -or ($LastExitCode -eq 3)){ #3 besagt das bestimmte Dateien nicht geoeffnet werden konnten
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup erfolgreich"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Es sind Fehler aufgetreten.`nBitte Log($restic_logfile_dir\$restic_logfile_name) pruefen!"
|
||||||
|
set-countdown -laufzeit 120 # ruft Funktion Countdown auf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Falscher Host(SOLL: $hostname_soll IST: $hostname_ist)"
|
||||||
|
Write-Host -ForegroundColor RED "Bitte den richtigen Host auswaehlen."
|
||||||
|
|
||||||
|
set-countdown -laufzeit 15 # ruft Funktion Countdown auf
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
#Variablen
|
|
||||||
#Variablen setzen
|
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
|
||||||
Split-Path $Invocation.MyCommand.Path
|
|
||||||
}
|
|
||||||
#funktion an variable zuweisen
|
|
||||||
$scriptpfad = Get-ScriptDirectory
|
|
||||||
#hostname
|
|
||||||
$hostname_ist = $env:computername
|
|
||||||
$hostname_soll = "tetraskelion"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\Portabel"
|
|
||||||
$ordner2="C:\Users\mg\Desktop"
|
|
||||||
$ordner3="C:\Users\mg\AppData\Roaming\StardewValley"
|
|
||||||
$ordner4=""
|
|
||||||
$ordner5=""
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
|
||||||
start-sleep 5
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
|
|
@ -1,46 +1,54 @@
|
||||||
#Variablen
|
############################# Funktionen #####################################
|
||||||
#Variablen setzen
|
# Setze Scriptpfad
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
function Get-ScriptDirectory {
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
||||||
Split-Path $Invocation.MyCommand.Path
|
Split-Path $Invocation.MyCommand.Path
|
||||||
}
|
}
|
||||||
#funktion an variable zuweisen
|
# Setze Timestamp
|
||||||
$scriptpfad = Get-ScriptDirectory
|
function get-timestamp{
|
||||||
#hostname
|
$timestamp = (get-date -Format yyyy_MM_dd__HH_mm_ss)
|
||||||
$hostname_ist = $env:computername
|
return $timestamp
|
||||||
$hostname_soll = "win10"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\Users\mg\Desktop"
|
|
||||||
$ordner2=""
|
|
||||||
$ordner3=""
|
|
||||||
$ordner4=""
|
|
||||||
$ordner5=""
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
}
|
||||||
else
|
# Funktion: countdown, zählt von einem Wert herunter bis 0
|
||||||
{
|
# der Wert $laufzeit muss übergeben werden, muss int sein, gibt länge des Countdowns an
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
# Bsp.: set-countdown -laufzeit $zeit_countdown oder set-countdown -laufzeit 5
|
||||||
start-sleep 5
|
function set-countdown([int]$laufzeit){
|
||||||
|
for ($laufzeit; $laufzeit -gt 0; $laufzeit--){
|
||||||
|
Start-Sleep -s 1 # wartet 1 Sekunde
|
||||||
|
write-host -ForegroundColor RED $laufzeit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################ Variablen ###################################
|
||||||
|
$scriptpfad = Get-ScriptDirectory # setzt den Pfad zum Script ohne endendes \
|
||||||
|
$timestamp = get-timestamp # setzt den Zeitstempel
|
||||||
|
$hostname_ist = $env:computername # ist-hostname
|
||||||
|
$hostname_soll = "win10" # soll-hostname
|
||||||
|
$restic_logfile_dir="\\fileserver2.grote.lan\backup\restic\logs" # ordner fur die logs
|
||||||
|
$restic_logfile_name=-join($hostname_ist,"_",$timestamp,".log") # definiere logfile-dateiname
|
||||||
|
$restic_repository="\\fileserver2.grote.lan\backup\restic" # restic repo
|
||||||
|
$restic_backupdir1="C:\Users\mg\Desktop"
|
||||||
|
$restic_path= Join-Path $scriptpfad bin\restic.exe
|
||||||
|
|
||||||
|
################################ Logik #######################################
|
||||||
|
if ($hostname_ist -eq $hostname_soll){
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup laeuft..."
|
||||||
|
& $restic_path --cleanup-cache --repo $restic_repository --password-file $scriptpfad\config\password.txt backup --exclude-file $scriptpfad\config\exclude.txt $restic_backupdir1 2>&1> $restic_logfile_dir\$restic_logfile_name
|
||||||
|
|
||||||
|
if (($LastExitCode -eq 0) -or ($LastExitCode -eq 3)){ #3 besagt das bestimmte Dateien nicht geoeffnet werden konnten
|
||||||
|
Write-Host -ForegroundColor GREEN "restic backup erfolgreich"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Es sind Fehler aufgetreten.`nBitte Log($restic_logfile_dir\$restic_logfile_name) pruefen!"
|
||||||
|
set-countdown -laufzeit 120 # ruft Funktion Countdown auf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Host -ForegroundColor RED "Falscher Host(SOLL: $hostname_soll IST: $hostname_ist)"
|
||||||
|
Write-Host -ForegroundColor RED "Bitte den richtigen Host auswaehlen."
|
||||||
|
|
||||||
|
set-countdown -laufzeit 15 # ruft Funktion Countdown auf
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
||||||
|
|
||||||
C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
#Variablen
|
|
||||||
#Variablen setzen
|
|
||||||
#variablendeklaration pfade
|
|
||||||
#scriptpfad ermitteln
|
|
||||||
#funktion get-scriptdirectory definieren
|
|
||||||
function Get-ScriptDirectory {
|
|
||||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
|
||||||
Split-Path $Invocation.MyCommand.Path
|
|
||||||
}
|
|
||||||
#funktion an variable zuweisen
|
|
||||||
$scriptpfad = Get-ScriptDirectory
|
|
||||||
#hostname
|
|
||||||
$hostname_ist = $env:computername
|
|
||||||
$hostname_soll = "vmw10mg"
|
|
||||||
|
|
||||||
#### restic ####
|
|
||||||
### repository
|
|
||||||
$repository="\\fileserver2.grote.lan\backup\restic"
|
|
||||||
### ordner fuer sicherung
|
|
||||||
$ordner1="C:\Users\mg\Desktop"
|
|
||||||
$ordner2=""
|
|
||||||
$ordner3=""
|
|
||||||
$ordner4=""
|
|
||||||
$ordner5=""
|
|
||||||
### passwordfile
|
|
||||||
$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt"
|
|
||||||
### exclude file
|
|
||||||
$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt"
|
|
||||||
### aktion/befehl
|
|
||||||
$befehl="backup"
|
|
||||||
|
|
||||||
|
|
||||||
# Hostname pruefen
|
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
|
||||||
{
|
|
||||||
Write-Host "Host = $hostname_ist"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)"
|
|
||||||
start-sleep 5
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5
|
|
|
@ -1 +0,0 @@
|
||||||
_0.9.6_windows_amd64
|
|
Loading…
Add table
Reference in a new issue