ThemeBackup
Type

iShare

Available from


Overview

If you are an iShare in the Cloud (ISC) customer then Astun automatically perform daily off-peak backups of the servers; one of the many benefits of being an ISC customer. These backups can be easily restored if an issue should arise.

Here we have include a script to allow you to backup your iShare Installation and Configuration, excluding databases, to a dated folder in your chosen location. Once configured, this may then be run manually or as a Scheduled Task.

See the topic Backing up your Database for details on how to backup your PostgreSQL database(s). You may also wish to Extract Non-System Functions from the iShare Database especially if you have created bespoke Functions.

The Script

REM WARNING: Make sure you change to the directory where iShare backups are stored before running this script
REM          to avoid deleting arbitrary files. Also ensure that the "Start in" directory is set when creating
REM          a Scheduled Task. The "Start in" directory should be the directory where iShare backups are stored
REM          such as D:\Backups\iShare
           
REM Tidy up by deleting files older than x days
REM NOTE: Read the warning above before removing the REM on the line below in order to enable deleting old files
REM PowerShell -NoProfile -ExecutionPolicy Bypass -Command "dir |? {$_.CreationTime -lt (get-date).AddDays(-8)} | del -r"

REM Get the current time, based on http://serverfault.com/a/227375
SET TIMESTAMP=
FOR /F "skip=1 delims=" %%F IN ('wmic os get LocalDateTime') DO IF NOT DEFINED TIMESTAMP SET TIMESTAMP=%%F

MKDIR "%TIMESTAMP:~0,14%"
CD "%TIMESTAMP:~0,14%"

REM iShare Maps

MKDIR .\Astun\iShare\5.4\
XCOPY D:\Astun\iShare\5.4\Paths.xml .\Astun\iShare\5.4\
XCOPY D:\Astun\iShare\5.4\Settings.xml .\Astun\iShare\5.4\

MKDIR .\Astun\iShare\5.4\Studio\config
XCOPY D:\Astun\iShare\5.4\Studio\config\* .\Astun\iShare\5.4\Studio\config\

MKDIR .\Astun\iShare\5.4\WebApps\Web
XCOPY D:\Astun\iShare\5.4\WebApps\Web\mycentralbeds* .\Astun\iShare\5.4\WebApps\Web\
XCOPY D:\Astun\iShare\5.4\WebApps\Web\Web.config .\Astun\iShare\5.4\WebApps\Web\

MKDIR .\Astun\iShare\5.4\WebApps\Web\custom
XCOPY /E D:\Astun\iShare\5.4\WebApps\Web\custom\* .\Astun\iShare\5.4\WebApps\Web\custom\

MKDIR .\Astun\iShare\5.4\WebApps\WebService
XCOPY /E D:\Astun\iShare\5.4\WebApps\WebService\web.config .\Astun\iShare\5.4\WebApps\WebService\

MKDIR .\Astun\iShare\5.4\WebApps\WebService\config
XCOPY /E D:\Astun\iShare\5.4\WebApps\WebService\config\* .\Astun\iShare\5.4\WebApps\WebService\config\

REM iShare GIS

MKDIR .\Astun\iShareGIS\5.4\
XCOPY D:\Astun\iShareGIS\5.4\Paths.xml .\Astun\iShareGIS\5.4\
XCOPY D:\Astun\iShareGIS\5.4\Settings.xml .\Astun\iShareGIS\5.4\

MKDIR .\Astun\iShareGIS\5.4\Studio\config
XCOPY D:\Astun\iShareGIS\5.4\Studio\config\* .\Astun\iShareGIS\5.4\Studio\config\

MKDIR .\Astun\iShareGIS\5.4\WebApps\Web
XCOPY D:\Astun\iShareGIS\5.4\WebApps\Web\cbcgis* .\Astun\iShareGIS\5.4\WebApps\Web\
XCOPY D:\Astun\iShareGIS\5.4\WebApps\Web\web.config .\Astun\iShareGIS\5.4\WebApps\Web\

MKDIR .\Astun\iShareGIS\5.4\WebApps\Web\custom
XCOPY /E D:\Astun\iShareGIS\5.4\WebApps\Web\custom\* .\Astun\iShareGIS\5.4\WebApps\Web\custom\

MKDIR .\Astun\iShareGIS\5.4\WebApps\Web\print
XCOPY /E D:\Astun\iShareGIS\5.4\WebApps\Web\print\* .\Astun\iShareGIS\5.4\WebApps\Web\print\

MKDIR .\Astun\iShareGIS\5.4\WebApps\WebService
XCOPY /E D:\Astun\iShareGIS\5.4\WebApps\WebService\web.config .\Astun\iShareGIS\5.4\WebApps\WebService\

MKDIR .\Astun\iShareGIS\5.4\WebApps\WebService\config
XCOPY /E D:\Astun\iShareGIS\5.4\WebApps\WebService\config\* .\Astun\iShareGIS\5.4\WebApps\WebService\config\

MKDIR .\Astun\iShareGIS\5.4\WebApps\WebService\xml
XCOPY /E D:\Astun\iShareGIS\5.4\WebApps\WebService\xml\* .\Astun\iShareGIS\5.4\WebApps\WebService\xml\

REM Common

MKDIR .\iShareData\
XCOPY /E D:\iShareData\* .\iShareData\
REM XCOPY /E /exclude:\path\to\excludelist.txt D:\iShareData\* .\iShareData\

CD ..

How to Implement

Tilecache considerations

Your tilecache directory may be 10s of gigabytes in size. If your tilecache is stored in a sub-directory of iShareData, then this script will also back that up. 

Consider whether you need to do this, and whether you have the space to do so in the backup location. 

If you do not wish to back up the tilecache, then:

Running the Script

Manually

As a Scheduled Task

Ensure that the "Start in" directory is set when creating a Scheduled Task. The "Start in" directory should be the directory where iShare backups are stored such as D:\Backups\iShare.