Difference between revisions of "Scheduling Backup"

From IMSMA Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{Under construction| }}  
 
{{Under construction| }}  
 +
{{Warning | This script '''only''' takes backup of the database and the attachments.}}
 +
 +
<ol>
 +
<li>
 
Modify the following script:
 
Modify the following script:
 
<pre>
 
<pre>
Line 15: Line 19:
 
</pre>
 
</pre>
  
Save it with name runIMSMAbackup.bat. Do NOT save it in the ''C:\IMSMAng'' folder.
+
<li>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:
+
<li>Schedule a task in the Operating System's Task scheduler. The following steps are done with Windows 7, follow those steps:
<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>
 
[[Image:Windows Scheduler.png|center|600px]]
 
[[Image:Windows Scheduler.png|center|600px]]
Line 25: Line 29:
 
<li>Next, refine recurrence criteria (e.g. time of the day) and click '''Next'''.</li>
 
<li>Next, refine recurrence criteria (e.g. time of the day) and click '''Next'''.</li>
 
<li>In the next window, select '''Start a Program''' and click '''Next'''.</li>
 
<li>In the next window, select '''Start a Program''' and click '''Next'''.</li>
<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:\backups\runIMSMAbackup.bat Click '''Next''' and then '''Finish'''.</li>
 
</ol>
 
</ol>
  

Revision as of 16:07, 2 August 2016

Ambox warning blue construction.png
Warning.jpg This script only takes backup of the database and the attachments.
  1. 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.
    
  2. Save it with name runIMSMAbackup.bat. Do not save it in the C:\IMSMAng folder.
  3. Schedule a task in the Operating System's Task scheduler. The following steps are done with Windows 7, follow those steps:
  4. Go to Control Panel → Administrative Tools → Task Scheduler
  5. Windows Scheduler.png
  6. In the Task Scheduler interface, click on Create Basic Task...
  7. In the Create Basic Task Wizard, provide a name, e.g. IMSMA Backup and an optional description. Click Next.
  8. In the next window, specify the required recurrence (daily, weekly, etc.) and click Next.
  9. Next, refine recurrence criteria (e.g. time of the day) and click Next.
  10. In the next window, select Start a Program and click Next.
  11. Browser to the previously created script, e.g. C:\backups\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