Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active May 5, 2016 03:32
Show Gist options
  • Save grenade/9112327 to your computer and use it in GitHub Desktop.
Save grenade/9112327 to your computer and use it in GitHub Desktop.
Restore TeamCity from a backup file, preserving artifacts and plugins
:: set these variables to match TeamCity environment
SET TEAMCITY_DATA_PATH=D:\Config\TeamCity
SET TEAMCITY_DATA_BACKUP=D:\Temp\TeamCity
SET TEAMCITY_HOME=C:\TeamCity
SET TEAMCITY_BACKUP_FILE=TeamCity_Backup_xxx_xxx.zip
:: maintainDB expects these directories to be empty or absent.
move /Y %%TEAMCITY_DATA_PATH%%\config %%TEAMCITY_DATA_BACKUP%%\config
move /Y %%TEAMCITY_DATA_PATH%%\system %%TEAMCITY_DATA_BACKUP%%\system
:: restore config and database
%%TEAMCITY_HOME%%\bin\maintainDB.cmd restore -F %%TEAMCITY_BACKUP_FILE%% -A %%TEAMCITY_DATA_PATH%% -T %%TEAMCITY_DATA_BACKUP%%\config\database.properties
:: restore artifacts and plugins
move /Y %%TEAMCITY_DATA_BACKUP%%\system\artifacts %%TEAMCITY_DATA_PATH%%\system\artifacts
move /Y %%TEAMCITY_DATA_BACKUP%%\system\pluginData %%TEAMCITY_DATA_PATH%%\system\pluginData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment