diff options
author | HÃ¥kon Hallingstad <hakon@oath.com> | 2018-01-23 10:08:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 10:08:26 +0100 |
commit | 41f9201a847e9b7aeb9641950db220dba0ab38bf (patch) | |
tree | df8c064cfe520034207333c222e67b64e3509029 /standalone-container | |
parent | 446c42d02f86780cc0626e29eddab56be33d50e3 (diff) |
Revert "Revert "Redefine task and its context""
Diffstat (limited to 'standalone-container')
-rwxr-xr-x | standalone-container/src/main/sh/standalone-container.sh | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/standalone-container/src/main/sh/standalone-container.sh b/standalone-container/src/main/sh/standalone-container.sh index dd0693f6f85..02c71beaac5 100755 --- a/standalone-container/src/main/sh/standalone-container.sh +++ b/standalone-container/src/main/sh/standalone-container.sh @@ -67,6 +67,7 @@ Manage Vespa standalone jdisc container service. Options: -u USER Run as USER. Overrides any VESPA_USER environment variable. -s SERVICE The service name. + -- ARGS... Pass the rest of the arguments (ARGS) to the Java invocation EOF exit 1 @@ -89,16 +90,19 @@ FixDataDirectory() { StartCommand() { local service="$1" shift - - if (( $# > 0 )); then - Fail "Too many arguments" - fi + local -a jvm_arguments=("$@") local service_regex='^[0-9a-zA-Z_-]+$' if ! [[ "$service" =~ $service_regex ]]; then Fail "Service must match regex '$service_regex'" fi + local pidfile="$VESPA_HOME/var/run/$service.pid" + if test -r "$pidfile"; then + echo "$service is already running as PID $(< "$pidfile") according to $pidfile" + return + fi + # common setup export VESPA_SERVICE_NAME="$service" @@ -135,6 +139,7 @@ StartCommand() { FixDataDirectory "$bundlecachedir" java \ + "${jvm_arguments[@]}" \ -Xms128m -Xmx2048m \ -XX:+PreserveFramePointer \ -XX:+HeapDumpOnOutOfMemoryError \ @@ -267,6 +272,7 @@ Main() { local service="standalone/container" local user="$VESPA_USER" + local -a jvm_arguments=() while (( $# > 0 )); do case "$1" in @@ -279,6 +285,11 @@ Main() { user="$2" shift 2 ;; + --) + shift + jvm_arguments=("$@") + break + ;; *) break ;; esac done @@ -300,7 +311,7 @@ Main() { case "$command" in help) Usage ;; - start) StartCommand "$service" "$@" ;; + start) StartCommand "$service" "${jvm_arguments[@]}" ;; stop) StopCommand "$user" "$service" "$@" ;; *) Fail "Unknown command '$command'" ;; esac |