Add a -v flag to output version information, closes #128

This commit is contained in:
kimchy 2010-04-26 11:05:56 +03:00
parent 2a19160ad6
commit 2878ae7dd6
2 changed files with 13 additions and 2 deletions

View File

@ -126,11 +126,16 @@ launch_service()
}
# Parse any command line options.
args=`getopt fhp:bD:X: "$@"`
args=`getopt vfhp:D:X: "$@"`
eval set -- "$args"
while true; do
case "$1" in
-v)
$JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $CLASSPATH $props \
org.elasticsearch.Version
exit 0
;;
-p)
pidfile="$2"
shift 2
@ -140,7 +145,7 @@ while true; do
shift
;;
-h)
echo "Usage: $0 [-d] [-h] [-p pidfile]"
echo "Usage: $0 [-f] [-h] [-p pidfile]"
exit 0
;;
-D)

View File

@ -19,6 +19,8 @@
package org.elasticsearch;
import org.elasticsearch.monitor.jvm.JvmConfig;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -72,4 +74,8 @@ public class Version {
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println("ElasticSearch Version: " + number + " (" + date() + "), JVM: " + JvmConfig.jvmConfig().vmVersion());
}
}