Код: Выделить всё
chcp 866
set day=%DATE:~0,2%
set month=%DATE:~3,2%
set year=%DATE:~6,4%
set YYYYMMDD=%year%%month%%day%
set dbUser=postgres
set PGPASSWORD=XXXXXXX
set SERVICE_1C_NAME="1C:Server"
set CNTX_PATH="D:\srvinfo\reg_1541"
set PFL_PATH="C:\ProgramData\1C\1cv8"
set TEMP_PATH="C:\Windows\Temp"
set pgdump="C:\Program Files (x86)\pgAdmin 4\v4\runtime\pg_dump.exe"
net use * /DELETE /YES
net use \\192.168.1.3\backup /USER:"admin" "XXXXXXXX"
rem Остановка 1С
sc stop %SERVICE_1C_NAME%
timeout 5
taskkill /f /im "rphost.exe"
taskkill /f /im "rmngr.exe"
taskkill /f /im "ragent.exe"
timeout 5
DEL /Q /F /S %CNTX_PATH%\snccntx*
DEL /Q /F %PFL_PATH%\*.pfl
DEL /Q /F /S %TEMP_PATH%\*.*
rem Резервное копирование
set mydb=rtl
set pathB=\\192.168.1.3\backup\1c-backup\rtl
%pgdump% -h localhost -p 5432 -U %dbUser% -w -F c -b -v -f "%pathB%\%YYYYMMDD%_%mydb%.backup" %mydb%
rem Запуск 1С
sc start %SERVICE_1C_NAME%
Код: Выделить всё
set pgdump="C:\Program Files (x86)\pgAdmin 4\v4\runtime\psql.exe"
set mydb=rtl
set dbUser=postgres
set PGPASSWORD=XXXXXXX
set pathB=\\192.168.1.3\backup\1c-backup\rtl
%psql% -U %dbUser% -W %PGPASSWORD% %mydb% < "%pathB%\%YYYYMMDD%_%mydb%.backup"