Changes

Jump to: navigation, search

Scheduling Backup

698 bytes added, 21:26, 3 August 2016
no edit summary
{{Under construction| }}
{{Warning | This script '''only''' takes backup of the database and the attachments.}}
<ol>
<li>Modify the following script:by replacing ''xyz'' at '''SIX''' places with the folder where you would like the backup folder to be created.
<pre>
:: IMSMA backup via bat file
@echo off
@echo Backing up the database. This may take awhile, do not close this window.:: C:\xyz being is the location folder where you desirewant the backups to be created. You The folder must exists before the script is started.:: The user starting the Task in the Windows scheduler must have read/write access to it. It has to be replaced at FOUR positions in this scriptthe folder.
c:\imsmang\pgsql\bin\pg_dump -U imsma > C:\xyz\dump.sql
@echo Creating folder
:: Creates a folder with the date as a timestamp, similar to the backups done in IMSMA. Then moves the dump.sql to it.
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%aset foldernamedatestamp=%dt:~0,8%set timestamp=%dt:~8,6%echo datestamp: "%datestamp%"echo timestamp: "%timestamp%"set YYYY=Backup_%datedt:~100,4%_set MM=%datedt:~4,2%_set DD=%datedt:~76,2%_set HH=%timedt:~08,2%_set Min=%timedt:~310,2%_set Sec=%timedt:~612,2%set foldername=Backup_%YYYY%_%MM%_%DD%_%HH%_%Min%_%Sec%
mkdir c:\xyz\%foldername%
move c:\xyz\dump.sql c:\AnneLifilerxyz\%foldername%\cmd @echo Copying the attachments:: uses xcopy to copy files from server destination to backup destination.:: /e Copies all subdirectories, even if they are empty]:: /h Copies hidden/system files:: /q suppresses output messagesmkdir c echo F | :\xyz\%foldername%\server\attachmentsxcopy C:\IMSMAng\server\attachments c:\xyz\%foldername%\server\attachments /c /e /i /h /q
@echo Done.
</pre>
6,632
edits

Navigation menu