-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa54e2a
commit 889f01c
Showing
2 changed files
with
35 additions
and
1 deletion.
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
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,32 @@ | ||
# Get App Name of Waterdrop | ||
function getAppName { | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Illegal number of parameters" | ||
exit -1 | ||
fi | ||
|
||
config_file_path=$1 | ||
|
||
app_name_config=$(grep -i "spark.app.name" ${config_file_path}) | ||
# remove all leading and trailing whitespace | ||
app_name_config=$(echo ${app_name_config} | tr -d '[:space:]') | ||
|
||
DEFAULT_APP_NAME="Waterdrop" | ||
APP_NAME=${DEFAULT_APP_NAME} | ||
|
||
if [[ ${app_name_config} == \#* ]]; then | ||
# spark.app.name is commented, we should ignore | ||
: | ||
else | ||
|
||
if [ "${app_name_config}" != "" ];then | ||
# split app_name from config | ||
APP_NAME=${app_name_config##*=} | ||
# remove quotes if exists | ||
APP_NAME=$(echo ${APP_NAME} | tr -d '"' | tr -d "'") | ||
fi | ||
fi | ||
|
||
echo ${APP_NAME} | ||
} |