Difference between revisions of "Scheduling Backup"

From IMSMA Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{Under construction| }}  
 
{{Under construction| }}  
<li>Schedule a task in the Operating System's Task scheduler. The following steps are done with Windows 7, follow those steps:
+
Modify the following script:
 +
<pre>
 +
@echo off
 +
@echo Backing up database. This may take awhile, do not close this window.
 +
:: C:\xyz being the location you desire. You must have read/write access to it. It has to be replaced at FOUR positions in this script.
 +
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.
 +
set foldername=Backup_%date:~10,4%_%date:~4,2%_%date:~7,2%_%time:~0,2%_%time:~3,2%_%time:~6,2%
 +
mkdir c:\xyz\%foldername%
 +
move c:\xyz\dump.sql c:\AnneLifiler\%foldername%\
 +
cmd /c echo F | xcopy C:\IMSMAng\server\attachments c:\xyz\%foldername%\server\attachments /c /e /i /h /q
 +
@echo Done.
 +
</pre>
 +
 
 +
Save it with name runIMSMAbackup.bat. Do NOT save it in the ''C:\IMSMAng'' folder.
 +
Schedule a task in the Operating System's Task scheduler. The following steps are done with Windows 7, follow those steps:
 
<ol>
 
<ol>
 
<li>Go to Control Panel &rarr; Administrative Tools &rarr; Task Scheduler</li>
 
<li>Go to Control Panel &rarr; Administrative Tools &rarr; Task Scheduler</li>
Line 11: Line 27:
 
<li>Browser to the previously created script, e.g. C:\runIMSMAbackup.bat Click '''Next''' and then '''Finish'''.</li>
 
<li>Browser to the previously created script, e.g. C:\runIMSMAbackup.bat Click '''Next''' and then '''Finish'''.</li>
 
</ol>
 
</ol>
</li>
 
  
 
The {{IMSMANG}} backup should now start at the specified time. <br/>
 
The {{IMSMANG}} backup should now start at the specified time. <br/>

Revision as of 17:03, 2 August 2016

Ambox warning blue construction.png

Modify the following script:

@echo off
@echo Backing up database. This may take awhile, do not close this window.
:: C:\xyz being the location you desire. You must have read/write access to it. It has to be replaced at FOUR positions in this script.
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.
set foldername=Backup_%date:~10,4%_%date:~4,2%_%date:~7,2%_%time:~0,2%_%time:~3,2%_%time:~6,2%
mkdir c:\xyz\%foldername%
move c:\xyz\dump.sql c:\AnneLifiler\%foldername%\
cmd /c echo F | xcopy C:\IMSMAng\server\attachments c:\xyz\%foldername%\server\attachments /c /e /i /h /q
@echo Done.

Save it with name runIMSMAbackup.bat. Do NOT save it in the C:\IMSMAng folder. Schedule a task in the Operating System's Task scheduler. The following steps are done with Windows 7, follow those steps:

  1. Go to Control Panel → Administrative Tools → Task Scheduler
  2. Windows Scheduler.png
  3. In the Task Scheduler interface, click on Create Basic Task...
  4. In the Create Basic Task Wizard, provide a name, e.g. IMSMA Backup and an optional description. Click Next.
  5. In the next window, specify the required recurrence (daily, weekly, etc.) and click Next.
  6. Next, refine recurrence criteria (e.g. time of the day) and click Next.
  7. In the next window, select Start a Program and click Next.
  8. Browser to the previously created script, e.g. C:\runIMSMAbackup.bat Click Next and then Finish.

The IMSMANG backup should now start at the specified time.

Scheduled bkp.png

It is advised to plan when to take the backup carefully, i.e. it is best during the night when no one is accessing and entering data into IMSMANG, as this might lead to inconsistencies.Template:NavBox How To Backup