Skip to content

Commit

Permalink
Allow to provide parameters not only through -D but as long parameters
Browse files Browse the repository at this point in the history
All getopt long style parameters are now set as es. properties,

elasticsearch --path.data=/some/path

results in -Des.path.data=/some/path

Closes #4393
  • Loading branch information
spinscale committed Dec 17, 2013
1 parent c30945a commit b713cf5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
18 changes: 17 additions & 1 deletion bin/elasticsearch
Expand Up @@ -150,8 +150,24 @@ launch_service()
fi
}

# Parse any long getopt options and put them into properties before calling getopt below
# Be dash compatible to make sure running under ubuntu works
ARGV=""
while [ $# -gt 0 ]
do
case $1 in
--*=*) properties="$properties -Des.${1#--}"
shift 1
;;
--*) properties="$properties -Des.${1#--}=$2"
shift 2
;;
*) ARGV="$ARGV $1" ; shift
esac
done

# Parse any command line options.
args=`getopt vdhp:D:X: "$@"`
args=`getopt vfhp:D:X: $ARGV`
eval set -- "$args"

while true; do
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/setup.asciidoc
Expand Up @@ -38,13 +38,13 @@ There are added features when using the `elasticsearch` shell script.
The first, which was explained earlier, is the ability to easily run the
process either in the foreground or the background.
Another feature is the ability to pass `-X` and `-D` directly to the
script. When set, both override anything set using either `JAVA_OPTS` or
`ES_JAVA_OPTS`. For example:
Another feature is the ability to pass `-X` and `-D` or getopt long style
configuration parameters directly to the script. When set, all override
anything set using either `JAVA_OPTS` or `ES_JAVA_OPTS`. For example:
[source,sh]
--------------------------------------------------
$ bin/elasticsearch -Xmx2g -Xms2g -Des.index.store.type=memory
$ bin/elasticsearch -f -Xmx2g -Xms2g -Des.index.store.type=memory --node.name=my-node
--------------------------------------------------
*************************************************************************
--
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/setup/installation.asciidoc
Expand Up @@ -28,12 +28,12 @@ There are added features when using the `elasticsearch` shell script.
The first, which was explained earlier, is the ability to easily run the
process either in the foreground or the background.
Another feature is the ability to pass `-X` and `-D` directly to the
script. When set, both override anything set using either `JAVA_OPTS` or
`ES_JAVA_OPTS`. For example:
Another feature is the ability to pass `-X` and `-D` or getopt long style
configuration parameters directly to the script. When set, all override
anything set using either `JAVA_OPTS` or `ES_JAVA_OPTS`. For example:
[source,sh]
--------------------------------------------------
$ bin/elasticsearch -Xmx2g -Xms2g -Des.index.store.type=memory
$ bin/elasticsearch -f -Xmx2g -Xms2g -Des.index.store.type=memory --node.name=my-node
--------------------------------------------------
*************************************************************************

0 comments on commit b713cf5

Please sign in to comment.