This guide runs you through setting up a GMVault backup as a Scheduled Task on Windows complete with email notification on failure.
- Download and install gmvault for windows.
- Download BLAT, unzip and copy to
%LOCALAPPDATA%/blat
- Download and install stunnel to
%LOCALAPPDATA%/stunnel
- Perform an initial sync for your account gmvault sync --db-dir=D:\backup\gmvault [email protected]
- Create a Scheduled Task which executes the following:
- Program:
%LOCALAPPDATA%\gmvault\gmvault.bat
- Arguments:
sync --db-dir D:\backup\gmvault --type quick [email protected]
- Start in:
%LOCALAPPDATA%\gmvault
-
Replace the contents of
%LOCALAPPDATA%/stunnel.conf
with: # GLOBAL OPTIONS client = yes output = stunnel-log.txt debug = 0 taskbar = no# SERVICE-LEVEL OPTIONS [SMTP Gmail] accept = 127.0.0.1:1099 connect = smtp.gmail.com:465 [POP3 Gmail] accept = 127.0.0.1:1109 connect = pop.gmail.com:995
-
Install stunnel as a service by opening an Administrator command prompt and executing: %LOCALAPPDATA%/stunnel/stunnel -install
-
Start the
Stunnel SSL Wrapper Service
and check it is set to start Automatically in future. -
Configure blat so it can send mail via your Google email account (You'll need to create a new one-time password if you are using two-factor auth): %LOCALAPPDATA%/blat/blat -install 127.0.0.1 %COMPUTERNAME%@domain.com - 1099 - [email protected] one-time-password
-
Check your stunnel and blat configuration by sending a test email: %LOCALAPPDATA%/blat/blat -debug -subject "Blat Test" -body "it works!" -to [email protected]
-
Use the following batch file to create a Scheduled Task which checks for failed tasks and emails you.
TO_EMAIL="[email protected]"
for /F "delims=" %%a in ('schtasks /query /v /fo:list ^| findstr /i "Taskname Result"') do call :Sub %%a
goto :eof
:Sub
set Line=%*
set BOL=%Line:~0,4%
set MOL=%Line:~38%
if /i %BOL%==Task ( set name=%MOL% goto :eof )
set result=%MOL%
echo Task Name=%name%, Task Result=%result%
if - %result%==0 (
blat -to %TO_EMAIL% -subject "Warning! Failed Scheduled Task on %computername%" -body "Task %name% failed with result %result% "
)