Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish scripts #641

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Polish scripts #641

merged 1 commit into from
Jul 12, 2023

Conversation

sakurai-youhei
Copy link
Member

  • Unify error message on missing libDir among all scripts
  • Unify DIAG_JAVA_OPTS between bat and sh files
  • Unify details such as quotation among each type of files
  • Port DIAG_DEBUG and related message from sh to bat files
  • Change DIAG_JAVA_OPTIONS to DIAG_JAVA_OPTS in bat files
  • Add /b option to exit in bat files
Test: Run bat files in source
C:\Users\YouheiSakurai\git\support-diagnostics>scripts\diagnostics.bat --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest

C:\Users\YouheiSakurai\git\support-diagnostics>scripts\import-monitoring.bat --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest

C:\Users\YouheiSakurai\git\support-diagnostics>scripts\export-monitoring.bat --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest

C:\Users\YouheiSakurai\git\support-diagnostics>scripts\scrub.bat --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest
Test: Run bat files in dist
C:\Users\YouheiSakurai\git\support-diagnostics>diagnostics-8.4.4-SNAPSHOT\diagnostics.bat --help
No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
Using -Xms256m -Xmx2000m  for options.
2023-05-27 04:24:45,370 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
C:\Users\YouheiSakurai\git\support-diagnostics>diagnostics-8.4.4-SNAPSHOT\import-monitoring.bat --help
No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
Using -Xms256m -Xmx2000m  for options.
2023-05-27 04:25:30,285 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
C:\Users\YouheiSakurai\git\support-diagnostics>diagnostics-8.4.4-SNAPSHOT\export-monitoring.bat --help
No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
Using -Xms256m -Xmx2000m  for options.
2023-05-27 04:25:56,400 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
C:\Users\YouheiSakurai\git\support-diagnostics>diagnostics-8.4.4-SNAPSHOT\scrub.bat --help
No Java Home was found. Using current path. If execution fails please install Java and make sure it is in the search path or exposed via the JAVA_HOME environment variable.
Using -Xms8g -Xmx8g  for options.
2023-05-27 04:26:15,047 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
Test: Run sh files in source
root@wsl:/mnt/c/Users/YouheiSakurai/git/support-diagnostics# scripts/diagnostics.sh --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest
root@wsl:/mnt/c/Users/YouheiSakurai/git/support-diagnostics# scripts/import-monitoring.sh --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest
root@wsl:/mnt/c/Users/YouheiSakurai/git/support-diagnostics# scripts/export-monitoring.sh --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest
root@wsl:/mnt/c/Users/YouheiSakurai/git/support-diagnostics# scripts/scrub.sh --help
Diagnostic executable not found:

Please make sure that you are running with the archive ending with
'-dist.zip' in the name and not the one labeled 'Source code'.

Download at https:/elastic/support-diagnostics/releases/latest
Test: Run bat files in dist
bash-4.4# diagnostics-8.4.4-SNAPSHOT/diagnostics.sh --help
Using /usr/java/openjdk-18/bin/java as Java Runtime
Using -Xms256m -Xmx2000m  for options.
2023-05-26 19:30:17,966 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...

bash-4.4# diagnostics-8.4.4-SNAPSHOT/import-monitoring.sh --help
Using /usr/java/openjdk-18/bin/java as Java Runtime
Using -Xms256m -Xmx2000m  for options.
2023-05-26 19:30:48,120 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
bash-4.4# diagnostics-8.4.4-SNAPSHOT/export-monitoring.sh --help
Using /usr/java/openjdk-18/bin/java as Java Runtime
Using -Xms256m -Xmx2000m  for options.
2023-05-26 19:31:07,463 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...
bash-4.4# diagnostics-8.4.4-SNAPSHOT/scrub.sh --help
Using /usr/java/openjdk-18/bin/java as Java Runtime
Using -Xms8g -Xmx8g  for options.
2023-05-26 19:31:29,387 main ERROR Unable to locate appender "diag" for logger config "root"
SLF4J: Class path contains multiple SLF4J bindings.
...

- Unify error message on missing libDir among all scripts
- Unify DIAG_JAVA_OPTS between bat and sh files
- Unify details such as quotation among each type of files
- Port DIAG_DEBUG and related message from sh to bat files
- Change DIAG_JAVA_OPTIONS to DIAG_JAVA_OPTS in bat files
- Add /b option to exit in bat files
@sakurai-youhei
Copy link
Member Author

diff between diagnostics.sh and import-monitoring.sh
--- scripts/diagnostics.sh      2023-05-27 03:30:24.935367000 +0900
+++ scripts/import-monitoring.sh        2023-05-27 03:30:22.879920300 +0900
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash

 scriptDir="$0"
-scriptDir="${scriptDir/\/diagnostics.sh/$''}"
+scriptDir="${scriptDir/\/import-monitoring.sh/$''}"
 libDir="$scriptDir"'/lib'

 if [ ! -d "$libDir" ]; then
@@ -32,4 +32,4 @@
 [[ "${DIAG_JAVA_OPTS}" == "" ]] && export DIAG_JAVA_OPTS="-Xms256m -Xmx2000m"

 echo "Using ${DIAG_JAVA_OPTS} ${DIAG_DEBUG_OPTS} for options."
-"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.diagnostics.DiagnosticApp "$@"
+"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.monitoring.MonitoringImportApp "$@"
diff between diagnostics.sh and export-monitoring.sh
--- scripts/diagnostics.sh      2023-05-27 03:30:24.935367000 +0900
+++ scripts/export-monitoring.sh        2023-05-27 03:30:24.036204500 +0900
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash

 scriptDir="$0"
-scriptDir="${scriptDir/\/diagnostics.sh/$''}"
+scriptDir="${scriptDir/\/export-monitoring.sh/$''}"
 libDir="$scriptDir"'/lib'

 if [ ! -d "$libDir" ]; then
@@ -32,4 +32,4 @@
 [[ "${DIAG_JAVA_OPTS}" == "" ]] && export DIAG_JAVA_OPTS="-Xms256m -Xmx2000m"

 echo "Using ${DIAG_JAVA_OPTS} ${DIAG_DEBUG_OPTS} for options."
-"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.diagnostics.DiagnosticApp "$@"
+"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.monitoring.MonitoringExportApp "$@"
diff between diagnostics.sh and scrub.sh
--- scripts/diagnostics.sh      2023-05-27 03:30:24.935367000 +0900
+++ scripts/scrub.sh    2023-05-27 03:30:21.295919000 +0900
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash

 scriptDir="$0"
-scriptDir="${scriptDir/\/diagnostics.sh/$''}"
+scriptDir="${scriptDir/\/scrub.sh/$''}"
 libDir="$scriptDir"'/lib'

 if [ ! -d "$libDir" ]; then
@@ -29,7 +29,7 @@

 [[ "${DIAG_DEBUG}" != "" ]] && export DIAG_DEBUG_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=y"

-[[ "${DIAG_JAVA_OPTS}" == "" ]] && export DIAG_JAVA_OPTS="-Xms256m -Xmx2000m"
+[[ "${DIAG_JAVA_OPTS}" == "" ]] && export DIAG_JAVA_OPTS="-Xms8g -Xmx8g"

 echo "Using ${DIAG_JAVA_OPTS} ${DIAG_DEBUG_OPTS} for options."
-"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.diagnostics.DiagnosticApp "$@"
+"$JAVA" $DIAG_JAVA_OPTS ${DIAG_DEBUG_OPTS} -cp "${scriptDir}/config:${scriptDir}/lib/*" co.elastic.support.scrub.ScrubApp "$@"
diff between diagnostics.bat and import-monitoring.bat
--- scripts/diagnostics.bat     2023-05-27 04:20:26.268379800 +0900
+++ scripts/import-monitoring.bat       2023-05-27 04:20:40.832312200 +0900
@@ -33,6 +33,6 @@
 )

 echo Using %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% for options.
-"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.monitoring.MonitoringImportApp %*

 endlocal
diff between diagnostics.bat and export-monitoring.bat
--- scripts/diagnostics.bat     2023-05-27 04:20:26.268379800 +0900
+++ scripts/export-monitoring.bat       2023-05-27 04:20:34.225764900 +0900
@@ -33,6 +33,6 @@
 )

 echo Using %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% for options.
-"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.monitoring.MonitoringExportApp %*

 endlocal
diff between diagnostics.bat and scrub.bat
--- scripts/diagnostics.bat     2023-05-27 04:20:26.268379800 +0900
+++ scripts/scrub.bat   2023-05-27 04:20:46.509470900 +0900
@@ -29,10 +29,10 @@
 )

 if not defined DIAG_JAVA_OPTS (
-  set DIAG_JAVA_OPTS=-Xms256m -Xmx2000m
+  set DIAG_JAVA_OPTS=-Xms8g -Xmx8g
 )

 echo Using %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% for options.
-"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.diagnostics.DiagnosticApp %*
+"%JAVA_EXEC%" %DIAG_JAVA_OPTS% %DIAG_DEBUG_OPTS% -cp %diagpath%\config;%diagpath%\lib\* co.elastic.support.scrub.ScrubApp %*

 endlocal

@pickypg pickypg merged commit 03894a3 into elastic:main Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants