-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVAULT_Backup.cmd
58 lines (33 loc) · 1.56 KB
/
VAULT_Backup.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@echo off
REM - - - - - - - - - - - - version 16july2021 - - -
REM
REM
REM 7-Zip (64bit) - http://www.7-zip.org
REM
REM Blat (64bit) - http://www.blat.net
REM
REM
REM - - - - - - - - - - - - - - - - - - - - - - - - -
set blatlocation=C:\Program Files\Blat
set ziplocation=C:\Program Files\7-Zip
set backupfolder=D:\Extensis Portfolio VAULT Backups
set numbertokeep=3
set backuplogfilename=VAULT_Backup_Log.txt
set emailserver=mail.example.com
set emailsubject="Portfolio Notification: VAULT Backup Log"
REM - - - - - - - - - - - - - - - - - - - - - - - - -
REM - - - - - - - - - - - - - - - - - - - - - - - - -
del "%backupfolder%\%backuplogfilename%" /Q
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set thedate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set thetime=%%a%%b)
set foldername=vault_%thedate%_T%thetime%
> "%backupfolder%\%backuplogfilename%" 2>&1 (
mkdir "%backupfolder%\%foldername%"
"C:\Program Files (x86)\Extensis\Portfolio Server\applications\mongodb\bin\mongodump.exe" --port 37017 --out "%backupfolder%\%foldername%"
"%ziplocation%\7z.exe" a -tzip "%backupfolder%\%foldername%.zip" "%backupfolder%\%foldername%"
rmdir "%backupfolder%\%foldername%" /s /q
forfiles -p "%backupfolder%" -s -m *.zip /D -%numbertokeep% /C "cmd /c del @path"
)
"%blatlocation%\blat.exe" "%backupfolder%\%backuplogfilename%" -to %emailto% -f %emailfrom% -s %emailsubject% -server %emailserver%