@echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"

@echo OFF

if not exist .\log\ (
	mkdir .\log\
)

echo %date% %time% >>.\log\rollback.log 2>&1
echo rollback ATIC begin...
call .\shell\rollback_atic.bat >>.\log\rollback.log 2>&1
if %errorlevel% == 0 (
	echo rollback ATIC successfully.
) else (
	echo rollback ATIC failed.
	pause;
	exit
)

set ori=%cd%
cd..
set bbd=%cd%
cd %ori%
set LOGCENTER_ROOT=%bbd%

echo rollback mysql begin...
echo %date% %time% >>.\log\rollback.log 2>&1
call .\shell\rollback_mysql.bat >>.\log\rollback.log 2>&1
if %errorlevel% == 0 (
	echo rollback mysql successfully.
) else (
	echo rollback mysql failed.
	pause;
	exit
)

echo %date% %time% >>.\log\rollback.log 2>&1
echo rollback finished.
pause;
