Backing up data¶
The octoplant system offers the option of backing up the server archive data manually or automatically at regular intervals using a batch file.
Prerequisites¶
To perform a data backup of the server archive, the following mandatory prerequisites must be met:
- The user who performs the data backup manually must have administrative rights on the server system.
- The VDog MasterService must be terminated before the data is backed up.
- The PostgreSQL database system (
PostgreSQL.exe
application) is terminated with the VDog MasterService. For security, you can check this in the Service Control Manager.
If these requirements are not met, the server archive may be destroyed and data may be lost.
Warning
The system is not available during the data backup. It is recommended to perform the data backup during off-peak times, for example at night or at weekends.
Options for saving storage space:
- The
VD_TMP_VD
directory in the server archive only contains temporary files. Back up the server archive without theVD_TMP_VD
directory. - The
vdServerArchive
directory can be compressed before backing up. A corresponding ZIP application must be installed for compression.
Backing up data manually¶
Warning
If you use a remote archive, you must always back up both the remote archive and the local server archive.
Local archive¶
Copy the local directory vdServerArchive
to the desired storage location, e.g. to an external hard disk.
Remote archive¶
Copy the vdServerArchive
directory of the remote share to the desired storage location, e.g. to an external hard disk.
Backing up data automatically¶
You can back up the vdServerArchive
directory automatically by creating a batch file and executing it at a specific time using the Windows Task Scheduler.
Info
It is not recommended to install the octoplant hub on a computer on which an octoplant server is already installed. If this has already been done, the octoplant hub services octoplanthub-postgres
and octoplanthubsvc
must also be terminated and subsequently restarted in the batch file in addition to the VDog MasterService. Your can find an example for the Backup.bat
file with the octoplant hub at the bottom of this page.
Example: Backup.bat file¶
Info
To use the batch file from the example for your system, adapt all path specifications in the file to your system.
set SERVERARCHIVE="D:\vdServerArchive\*"
rem If no remote archive, set the variable remotearchive to an empty value.
rem set REMOTEARCHIVE=""
set REMOTEARCHIVE="\\storage\share\vdServerArchive\*"
set OUTFILE="D:\vdServerBackup.zip"
set 7ZIP="%PROGRAMFILES(x86)%\7-Zip\7z.exe"
net stop "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop server
exit /B %ERRORLEVEL%
)
)
tasklist /fi "ImageName eq VDog*" /fo csv 2>NUL | find /I "VDog">NUL
if "%ERRORLEVEL%"=="0" (
echo Server processes still running
tasklist /fi "ImageName eq VDog*" /fo csv
exit /B 1
)
tasklist /fi "ImageName eq postgres.exe" /fo csv 2>NUL | find /I "postgres.exe">NUL
if "%ERRORLEVEL%"=="0" (
tasklist /fi "ImageName eq postgres.exe" /fo csv
echo Database processes still running
exit /B 1
)
REM Backup local server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %SERVERARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip server archive
exit /B %ERRORLEVEL%
)
if "%REMOTEARCHIVE%" == "" GOTO startms
REM Backup remote server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %REMOTEARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip remote archive
exit /B %ERRORLEVEL%
)
:startms
net start "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start server
exit /B %ERRORLEVEL%
)
echo "success"
pause
Example Backup.bat file (with octoplant hub)
set SERVERARCHIVE="D:\vdServerArchive\*"
rem If no remote archive, set the variable remotearchive to an empty value.
rem set REMOTEARCHIVE=""
set REMOTEARCHIVE="\\storage\share\vdServerArchive\*"
set OUTFILE="D:\vdServerBackup.zip"
set 7ZIP="%PROGRAMFILES(x86)%\7-Zip\7z.exe"
echo Stopping server
net stop "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop server
exit /B %ERRORLEVEL%
)
)
echo Stopping hub database
net stop "octoplanthub-postgres"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop hub database
exit /B %ERRORLEVEL%
)
)
echo Stopping hub
net stop "octoplanthubsvc"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop hub
exit /B %ERRORLEVEL%
)
)
tasklist /fi "ImageName eq VDog*" /fo csv 2>NUL | find /I "VDog">NUL
if "%ERRORLEVEL%"=="0" (
echo Server Processes still running
tasklist /fi "ImageName eq VDog*" /fo csv
exit /B 1
)
tasklist /fi "ImageName eq postgres.exe" /fo csv 2>NUL | find /I "postgres.exe">NUL
if "%ERRORLEVEL%"=="0" (
tasklist /fi "ImageName eq postgres.exe" /fo csv
echo Database Processes still running
exit /B 1
REM Backup local server archive with 7-zip
%7ZIP% u -t7z -r %OUTFILE% %SERVERARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip server archive
exit /B %ERRORLEVEL%
)
if "%REMOTEARCHIVE%" == "" GOTO startms
REM Backup remote server archive with 7-zip
%7ZIP% u -t7z -r %OUTFILE% %REMOTEARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip remote archive
exit /B %ERRORLEVEL%
)
:startms
echo Starting server
net start "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start server
exit /B %ERRORLEVEL%
)
echo Starting hub database
net start "octoplanthub-postgres"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start hub database
exit /B %ERRORLEVEL%
)
echo Starting hub
net start "octoplanthubsvc"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start hub
exit /B %ERRORLEVEL%
)
echo "success"
pause