Guten Morgen,
bin auf meinem Server von Win 8.1 auf Win 10 umgestiegen.
Alles läuft wieder wie gehabt, nur bei einem Fehler find ich keine Lösung.
Zur "Sicherung" der Film- und Seriensammlung nutze ich SnapRaid.
Dazu wird täglich ein Skript ausgeführt.
Leider wirft mir dieses seit dem Umstieg am Ende einen Fehler aus.
Der Völlständigkeit halber folgend das ganze Skript ...
Fehler kommt irgendwo ab Zeile 91 zustande
Spoiler anzeigen
Code
@ECHO off
CHCP 65001 > nul
SET param=%~1
IF NOT "%param%"=="" (
IF "%param%"=="skipdel" (
ECHO Skipping deleted file threshold check...
) ELSE IF "%param%"=="skipdiff" (
ECHO Skipping diff check...
) ELSE IF "%param%"=="skipscrub" (
ECHO Skipping scrub routine...
) ELSE (
ECHO.
ECHO skipdel = skips deleted files threshold check.
ECHO skipdiff = skips diff check ^(and delete threshold^).
ECHO skipscrub = skips scrub routine^(s^).
EXIT /b
)
)
:Config
REM If password has a &, escape it with ^. So pass&word = pass^&word.
SET emailto=***
SET emailfrom=***
SET gmailuser=***
SET gmailpass=***
SET srpath=C:\snapraid
SET delthresh=100
:CheckRunning
MD %srpath%\[definition='1','0']log[/definition]\
tasklist /FI "IMAGENAME eq snapraid.exe" 2>NUL | find /I /N "snapraid.exe">NUL
IF NOT "%ERRORLEVEL%"=="0" goto RunDiff
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
ECHO Can not run task because snapraid.exe instance exists
ECHO Can not run task because snapraid.exe instance exists > "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_sync.[definition='1','0']log[/definition]" 2>&1
mailsend -smtp "smtp.gmail.com" -starttls -port 587 -auth -t "%emailto%" +cc +bc -f "%emailfrom%" -sub "SnapRAID Already Running at Triggered Time" -M "empty" -user "%gmailuser%" -pass "%gmailpass%"
EXIT /B 555
:RunDiff
IF "%param%"=="skipdiff" GOTO RunSync
ECHO Running diff check
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
snapraid diff -v > "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_diff.[definition='1','0']log[/definition]" 2>&1
rxrepl -f "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_diff.[definition='1','0']log[/definition]" -o "%srpath%\removed.cnt" --no-backup --no-bom -i -s ".*?(\d+) removed\r\n.*" -r "\1"
rxrepl -f "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_diff.[definition='1','0']log[/definition]" -o "%srpath%\added.cnt" --no-backup --no-bom -i -s ".*?(\d+) added\r\n.*" -r "\1"
SET /p intrem=<"%srpath%\removed.cnt"
SET /p intadd=<"%srpath%\added.cnt"
DEL "%srpath%\removed.cnt"
DEL "%srpath%\added.cnt"
:CheckRemoved
IF "%param%"=="skipdel" GOTO RunSync
IF %intrem% GTR %delthresh% (
mailsend -smtp "smtp.gmail.com" -starttls -port 587 -auth -t "%emailto%" +cc +bc -f "%emailfrom%" -sub "SnapRAID not running: %intrem% files removed." -M "%atimestamp%. %intrem% removed. %intadd% added." -user "%gmailuser%" -pass "%gmailpass%"
EXIT /B 999
)
:RunSync
ECHO Running sync
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
snapraid sync -v --test-io-cache=32 > "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_sync.[definition='1','0']log[/definition]" 2>&1
SET syncresult=%ERRORLEVEL%
REM rxrepl -f "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_sync.[definition='1','0']log[/definition]" -a --no-backup --no-bom -i -s "\d+\%%,\s+\d+\sMiB.*?\r\n" -r ""
:RunScrubN
IF "%param%"=="skipscrub" GOTO RunStatus
ECHO Running scrub of new data
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
snapraid scrub -p new -v --test-io-cache=32 > "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_scrub1.[definition='1','0']log[/definition]" 2>&1
SET scrubnresult=%ERRORLEVEL%
REM rxrepl -f "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_scrub1.[definition='1','0']log[/definition]" -a --no-backup --no-bom -i -s "\d+\%%,\s+\d+\sMiB.*?\r\n" -r ""
:RunScrubO
IF "%param%"=="skipscrub" GOTO RunStatus
ECHO Running scrub of oldest 3%%
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
snapraid scrub -p 3 -v --test-io-cache=32 > "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_scrub2.[definition='1','0']log[/definition]" 2>&1
SET scruboresult=%ERRORLEVEL%
REM rxrepl -f "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_scrub2.[definition='1','0']log[/definition]" -a --no-backup --no-bom -i -s "\d+\%%,\s+\d+\sMiB.*?\r\n" -r ""
:RunStatus
ECHO Running Status
SET atimestamp=%date%_%time::=;%
SET atimestamp=%atimestamp: =0%
snapraid status -v >> "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_status.[definition='1','0']log[/definition]" 2>&1
SET statusresult=%ERRORLEVEL%
:CheckStatusLog
SET statuswarn=0
findstr /m "WARNING" "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_status.[definition='1','0']log[/definition]"
IF %ERRORLEVEL%==0 (
SET statuswarn=1
)
SET statusdanger=0
findstr /m "DANGER" "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_status.[definition='1','0']log[/definition]"
IF %ERRORLEVEL%==0 (
SET statusdanger=1
)
SET statusgood=GOOD
IF NOT %syncresult%==0 SET statusgood=ERROR
IF NOT %scrubnresult%==0 SET statusgood=ERROR
IF NOT %scruboresult%==0 SET statusgood=ERROR
IF NOT %statusresult%==0 SET statusgood=ERROR
IF NOT %statuswarn%==0 SET statusgood=ERROR
IF NOT %statusdanger%==0 SET statusgood=ERROR
SET statusstring=(sync:%syncresult%)(scrub1:%scrubnresult%)(scrub2:%scruboresult%)(status:%statusresult%)(warn:%statuswarn%)(danger:%statusdanger%)
SET diffstring=(REM:%intrem%)(ADD:%intadd%)
mailsend -smtp "smtp.gmail.com" -starttls -port 587 -auth -t "%emailto%" +cc +bc -f "%emailfrom%" -sub "SnapRAID Status %statusgood% %statusstring% %diffstring%" -attach "%srpath%\[definition='1','0']log[/definition]\%atimestamp%_status.[definition='1','0']log[/definition]",text/plain,i -user "%gmailuser%" -pass "%gmailpass%"
EXIT /B 0
Alles anzeigen
:RunStatus wird noch ausgeführt und auch das entsprechende Logfile angelegt - "2019-01-19_08;22;31,06_status.[definition='1','0']log[/definition]"
Dann wird aber scheinbar nach der falschen Datei gesucht.
Hier die Fehlermeldung:
Spoiler anzeigen
Code
Running diff check
Running sync
Running scrub of new data
Running scrub of oldest 3%
Running Status
Could not stat file C:\snapraid\[definition='1','0']log[/definition]\2019-01-19_08;22;31
Error: Could not determine file type of C:\snapraid\[definition='1','0']log[/definition]\2019-01-19_08;22;31
Error: smtp.c (711) - Could not open file for C:\snapraid\[definition='1','0']log[/definition]\2019-01-19_08;22;31 reading (No such file or directory)
Error: smtp.c (779) - Could not encode attachment C:\snapraid\[definition='1','0']log[/definition]\2019-01-19_08;22;31
Error: smtp.c (894) - failed to send attachment C:\snapraid\[definition='1','0']log[/definition]\2019-01-19_08;22;31
Could not send mail
Zur Verarbeitung dieses Befehls sind nicht genügend Speicherressourcen verfügbar.
Alles anzeigen
Sieht von euch jemand den Fehler?
Unter Win 8 wurde 1:1 das gleich Skript verwendet.
Grüße