I notice it because no more emails come. Then when I look in the web interface, there are some ERROR popups.
My backup scenario is quite complex. I will try to explain it:
I have 3 backup jobs. All of them start at 10pm.
- job Backup Server
- job External_1
3rd job External_2
The 1st job backs up to a server, for the 2nd and 3rd jobs there is an external hard drive for each, alternating between them on the computer.
This is my configuration for job 1 and 2
--alternate-destination-marker=backup1.txt
--alternate-target-paths=*:\backup
--send-mail-body=C:\Tools\extern\email.txt
--send-mail-from=XXXXXXXX@magenta.de
--send-mail-password=XXXXXXX
--send-mail-to=MYEMAIL
--send-mail-level=all
--send-mail-subject=Duplicati %OPERATIONNAME% report for %backup-name%
--send-mail-url=smtps://securesmtp.t-online.de:465
--send-mail-username=XXXXXXX@magenta.de
--run-script-before=C:\Tools\extern\todo_extern.bat
--run-script-after=C:\Tools\extern\todo_extern.bat
--run-script-before-required=C:\Tools\extern\before_extern1_req.bat
--backup-test-percentage=10
--backup-test-samples=50
–run-script-before-required=C:\Tools\extern\before_extern1_req.bat
@echo off
rem & SETLOCAL EnableDelayedExpansion
rem Edit Disklabel here:
set Disklabel=Backup1
REM *** Pfad für die Emails setzen
set Pfad=c:\tools\extern
REM *** aktuelle Systemzeit auslesen
rem set "time=22:35"
set hour=%time:~0,2%
set min=%time:~3,2%
REM *** Zeitfenster in dem kein Backup starten darf
set "begin=4"
set "ende=21"
rem Abfrage ob Jobname ungleich Backup ist, dann springe direkt zu Label PLATTE und beachte nicht die UHRZEIT.
rem Dies wird gebraucht bei einem RESTORE, um unabhängig der Uhrzeit diesen auszuführen.
if /i "%DUPLICATI__OPERATIONNAME%" neq "Backup" goto PLATTE
if %hour% GEQ %ende% (
echo Jetzt darf Backup1
goto PLATTE
) ELSE (
if %hour% LEQ %begin% (
if %hour% EQU %begin% if %min% GTR 00 (
echo Jetzt darf kein Backup1
copy %Pfad%\email_praxis1.txt %Pfad%\email.txt /Y
exit /b 0
)
echo Jetzt darf Backup2
goto PLATTE
) ELSE (
echo Jetzt darf kein Backup2
copy %Pfad%\email_praxis2.txt %Pfad%\email.txt /Y
exit /b 0
)
)
goto END
:PLATTE
for /f "tokens=1" %%a in ('wmic volume get label ^| findstr /i Backup') do (
echo Label = %%a
set Label=%%a
)
echo Benutze Volume %Label%
if "%Label%"=="" (
echo keine Platte
copy %Pfad%\email_none.txt %Pfad%\email.txt /Y
rem Backup wird loslaufen, aber failen.
goto END
) else (
echo Platte da. ist es die richtige?
if "%Label%"=="%Disklabel%" (
echo ok, Richtige Disk gefunden
copy %Pfad%\email_normal.txt %Pfad%\email.txt /Y
rem Backup wird normal laufen.
goto END
) else (
echo ok, Falsche Disk gefunden
copy %Pfad%\email_wrong.txt %Pfad%\email.txt /Y
rem Backup wird loslaufen, aber failen.
exit /B 3
)
)
:END
exit /B 0
–run-script-before=C:\Tools\extern\todo_extern.bat
REM We read a few variables first.
SET EVENTNAME=%DUPLICATI__EVENTNAME%
SET OPERATIONNAME=%DUPLICATI__OPERATIONNAME%
REM SET REMOTEURL=%DUPLICATI__REMOTEURL%
SET LOCALPATH=%DUPLICATI__LOCALPATH%
SET PARSEDRESULT=%DUPLICATI__PARSED_RESULT%
SET THUNDER=thunderbirdportable.exe
SET FIRE=firefoxportable.exe
REM Basic setup, we use the same file for both before and after,
REM so we need to figure out which event has happened
if "%EVENTNAME%" == "BEFORE" GOTO ON_BEFORE
if "%EVENTNAME%" == "AFTER" GOTO ON_AFTER
REM This should never happen, but there may be new operations
REM in new version of Duplicati
REM We write this to stderr, and it will show up as a warning in the logfile
echo Got unknown event "%EVENTNAME%", ignoring 1>&2
GOTO end
:ON_BEFORE
IF "%OPERATIONNAME%" == "Backup" GOTO ON_BEFORE_BACKUP
REM This will be ignored
echo Got operation "%OPERATIONNAME%", ignoring
GOTO end
:ON_BEFORE_BACKUP
tasklist | find /I /N "%THUNDER%">NUL
if "%ERRORLEVEL%"=="0" (
taskkill /F /IM %THUNDER% /T >NUL
ping -n 20 localhost> nul
) else (
tasklist | find /I /N "Explorer.EXE">NUL
)
tasklist | find /I /N "%FIRE%">NUL
if "%ERRORLEVEL%"=="0" (
taskkill /F /IM %FIRE% /T >NUL
) else (
tasklist | find /I /N "Explorer.EXE">NUL
)
GOTO end
:ON_AFTER
IF "%OPERATIONNAME%" == "Backup" GOTO ON_AFTER_BACKUP
REM This will be ignored
echo "Got operation "%OPERATIONNAME%", ignoring "
GOTO end
:ON_AFTER_BACKUP
rem start shutdown.exe /s /f /t 60
start calc.exe
GOTO end
REM We want the exit code to always report success.
REM For scripts that can abort execution, use the option
REM --run-script-on-start-required = <filename> when running Duplicati
:end
exit /B 0
For job 2 is --alternate-destination-marker=backup2.txt
The process looks like this:
At 10pm the server backup starts.
As soon as this is finished, job 2 starts.
Job 2 checks if the correct disk is connected and if there is a disk connected at all. If the correct disk is connected, the backup job starts. If the wrong disk or no disk at all is connected, the backup job should not be executed.
As soon as job 2 is finished, job 3 starts.
Job 3 checks whether the correct disk is connected and whether a disk is connected at all. If the correct disk is connected, the backup job starts. If the wrong disk or no disk at all is connected, the backup job should not be executed.
Basically this seems to work, but the errorhandling of Duplicati gives me problems. It looks like it only sends emails when the backup job is started. It does not send emails if the job is not executed because of an error or a warning. Error 1,3,5.
Many greetings Mike