Skip to content

Instantly share code, notes, and snippets.

@jeremybeavon
Forked from grenade/restore-teamcity.cmd
Last active May 5, 2016 03:34
Show Gist options
  • Save jeremybeavon/6ed8325c9d1786ab1153860b4a4976a7 to your computer and use it in GitHub Desktop.
Save jeremybeavon/6ed8325c9d1786ab1153860b4a4976a7 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=D:\Config\TeamCity\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
@jeremybeavon
Copy link
Author

For some reason I needed % instead of %%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment