Skip to content

Commit 2878ae7

Browse files
committed
Add a -v flag to output version information, closes #128
1 parent 2a19160 commit 2878ae7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

bin/elasticsearch

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ launch_service()
126126
}
127127

128128
# Parse any command line options.
129-
args=`getopt fhp:bD:X: "$@"`
129+
args=`getopt vfhp:D:X: "$@"`
130130
eval set -- "$args"
131131

132132
while true; do
133133
case "$1" in
134+
-v)
135+
$JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $CLASSPATH $props \
136+
org.elasticsearch.Version
137+
exit 0
138+
;;
134139
-p)
135140
pidfile="$2"
136141
shift 2
@@ -140,7 +145,7 @@ while true; do
140145
shift
141146
;;
142147
-h)
143-
echo "Usage: $0 [-d] [-h] [-p pidfile]"
148+
echo "Usage: $0 [-f] [-h] [-p pidfile]"
144149
exit 0
145150
;;
146151
-D)

modules/elasticsearch/src/main/java/org/elasticsearch/Version.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.elasticsearch;
2121

22+
import org.elasticsearch.monitor.jvm.JvmConfig;
23+
2224
import java.io.InputStream;
2325
import java.text.SimpleDateFormat;
2426
import java.util.Date;
@@ -72,4 +74,8 @@ public static String full() {
7274
}
7375
return sb.toString();
7476
}
77+
78+
public static void main(String[] args) {
79+
System.out.println("ElasticSearch Version: " + number + " (" + date() + "), JVM: " + JvmConfig.jvmConfig().vmVersion());
80+
}
7581
}

0 commit comments

Comments
 (0)