-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After: * Move configuration files to c:\opt\fluent\etc\fluent\td-agent.conf * Create symbolic link to c:\opt\fluent\etc\fluent. Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com> Co-authored-by: Daijiro Fukuda <fukuda@clear-code.com>
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
fluent-package/msi/assets/fluent-package-post-migration.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@echo on | ||
title Fluent-package post migration script | ||
|
||
if exist "%~dp0..\..\td-agent" ( | ||
setlocal enabledelayedexpansion | ||
sc query state=inactive | findstr fluentdwinsvc | ||
if !ERRORLEVEL! == 1 ( | ||
@rem NOTE: If the service is not stopped here, it is a BUG. | ||
@rem This state can cause fatal problems with the installation, so we should cancel this process. | ||
@rem (If trying to stop it by the command such as `$ net stop fluentdwinsvc`, it can fail as "The service is starting or stopping. Please try again later.".) | ||
echo "WARN: Active fluentdwinsvc service is detected. This is unexpected. Migration process has been canceled." | ||
exit /b 1 | ||
) | ||
endlocal | ||
|
||
if not exist "%~dp0..\etc\fluent" ( | ||
echo "Create c:\opt\fluent\etc\fluent directory" | ||
mkdir "%~dp0..\etc\fluent" | ||
) | ||
|
||
if exist "%~dp0..\..\td-agent\etc\td-agent\td-agent.conf" ( | ||
echo "Migrate c:\opt\td-agent\etc\td-agent.conf" | ||
move /Y "%~dp0..\..\td-agent\etc\td-agent\td-agent.conf" "%~dp0..\etc\fluent\td-agent.conf" | ||
echo "Migrate td-agent.conf to c:\opt\fluent\etc\fluent\fluentd.conf" | ||
copy /Y "%~dp0..\etc\fluent\td-agent.conf" "%~dp0..\etc\fluent\fluentd.conf" | ||
) | ||
|
||
@rem NOTE: do not migrate log files not to lose log accidentally | ||
|
||
echo "Migrate c:\opt\td-agent\etc\td-agent\* files" | ||
for %%f in (%~dp0..\..\td-agent\etc\td-agent\*) do ( | ||
move /Y %%f "%~dp0..\etc\fluent\" | ||
) | ||
if not exist "%~dp0..\etc\fluent\plugin" ( | ||
mkdir "%~dp0..\etc\fluent\plugin" | ||
) | ||
echo "Migrate c:\opt\td-agent\etc\plugin directory" | ||
for /d %%d in (%~dp0..\..\td-agent\etc\plugin\*) do ( | ||
move /Y %%d "%~dp0..\etc\fluent\plugin\" | ||
) | ||
|
||
echo "Ensure remaining files under td-agent" | ||
tree %~dp0..\..\td-agent | ||
|
||
@rem create symbolic link to c:\opt\fluent (we can't use hardlink for directory) | ||
if exist "%~dp0..\..\td-agent\etc\td-agent" ( | ||
rmdir /S /Q "%~dp0..\..\td-agent\etc\td-agent" | ||
) | ||
echo "Create symlink c:\opt\td-agent\etc\td-agent to c:\opt\fluent\etc\fluent" | ||
mklink /D %~dp0..\..\td-agent\etc\td-agent %~dp0..\..\fluent\etc\fluent | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters