Skip to content

Use gradle installDist to generate starter script #20

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ dependencies {
testCompile("org.springframework.boot:spring-boot-starter-test:1.4.2.RELEASE")
}

startScripts{
applicationName = 'hdfs-shell'
unixStartScriptGenerator.template = resources.text.fromFile('deploy/bin/hdfs_shell.unix.template.sh')
windowsStartScriptGenerator.template = resources.text.fromFile('deploy/bin/hdfs_shell.win.template.bat')
}

17 changes: 17 additions & 0 deletions deploy/bin/hdfs_shell.unix.template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
SCRIPT_FULL_PATH="\$(readlink -f "\${BASH_SOURCE[0]}")"
BIN_DIR="\$(dirname "\${SCRIPT_FULL_PATH}")"
LIB_DIR="\$(readlink -f "\${BIN_DIR}/../lib")"
HADOOP_DIR="\${HADOOP_CONF_DIR:-/etc/hadoop/conf}"
HADOOP_CLASSPATH="\${HADOOP_CLASSPATH:-\$(hadoop classpath)}"
command_args=(java -Xms200m -Xmx400m -cp "\${LIB_DIR}/*:\${HADOOP_DIR}:\${HADOOP_CLASSPATH}")
echo "Launching HDFS Shell with HADOOP_CONF_DIR: \${HADOOP_DIR}"

while (( \$# > 0 )); do
case "\$1" in
-d|--daemon) command_args+=('-Ddaemon=true'); shift;;
esac
shift
done
command_args+=( ${mainClassName} "\$@")
command "\${command_args[@]}"
12 changes: 12 additions & 0 deletions deploy/bin/hdfs_shell.win.template.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..
set LIB_DIR=%APP_HOME%/lib

echo Launching HDFS Shell with HADOOP_CONF_DIR: %HADOOP_DIR%
java.exe -Xms200m -Xmx400m -cp "%LIB_DIR%/*;%HADOOP_DIR%:%HADOOP_CLASSPATH%" ${mainClassName} %CMD_LINE_ARGS%
if "%OS%"=="Windows_NT" endlocal