From 01ba660fe75e9813eff0e90efa93a2dfb8d264b8 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Sun, 12 Nov 2017 13:52:03 +0000 Subject: [PATCH] sysconfig: correct the assignment in env file of systemd This commit e80a5e3cb319fc80c669d6d75f5abeb0d781758b introduced an issue, it wrongly passes an empty string to scylla-jmx cmdline, which causes scylla-jmx script stuck. The cmdline real executes is: # scylla-jmx -l /usr/lib/scylla/jmx "" Wrapped quotation marks of env variable can't be parsed away if we use ${SCYLLA_PARAMS} in ExecStart cmdline, but $SCYLLA_PARAMS works. Another problem is the variable can't be re-used insider env file, reference: [1]. Let's split the parameters to multiple env variables, and combine them in ExecStart cmdline. [1] https://unix.stackexchange.com/questions/358998/systemd-environmentfile-re-using-variables-how Fixes scylladb/scylla#2935 Signed-off-by: Amos Kong Message-Id: --- dist/common/sysconfig/scylla-jmx | 18 ++++++++---------- dist/common/systemd/scylla-jmx.service.in | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/dist/common/sysconfig/scylla-jmx b/dist/common/sysconfig/scylla-jmx index e15829a..2a634ab 100644 --- a/dist/common/sysconfig/scylla-jmx +++ b/dist/common/sysconfig/scylla-jmx @@ -4,28 +4,26 @@ SCYLLA_HOME=/var/lib/scylla # scylla config dir SCYLLA_CONF=/etc/scylla -SCYLLA_PARAMS="" - # The jmx port to open -# SCYLLA_PARAMS="${SCYLLA_PARAMS } -jp 7199" +# SCYLLA_JMX_PORT="-jp 7199" # The API port to connect to -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -p 12345" +#SCYLLA_API_PORT="-p 10000" # API address to connect to -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -a `hostname`" +#SCYLLA_API_ADDR="-a localhost" # use alternate jmx address -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -ja `hostname`" +#SCYLLA_JMX_ADDR="-ja localhost" # A configuration file to use -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -cf /etc/scylla.d/scylla-user.cfg" +#SCYLLA_JMX_FILE="-cf /etc/scylla.d/scylla-user.cfg" # The location of the jmx proxy jar file -# SCYLLA_PARAMS="${SCYLLA_PARAMS} target /some/scripts" +SCYLLA_JMX_LOCAL="-l /usr/lib/scylla/jmx" # allow to run remotely -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -r" +#SCYLLA_JMX_REMOTE="-r" # allow debug -# SCYLLA_PARAMS="${SCYLLA_PARAMS} -d" +#SCYLLA_JMX_DEBUG="-d" diff --git a/dist/common/systemd/scylla-jmx.service.in b/dist/common/systemd/scylla-jmx.service.in index 758dc66..df76cfc 100644 --- a/dist/common/systemd/scylla-jmx.service.in +++ b/dist/common/systemd/scylla-jmx.service.in @@ -8,7 +8,7 @@ Type=simple EnvironmentFile=@@SYSCONFDIR@@/scylla-jmx User=scylla Group=scylla -ExecStart=/usr/lib/scylla/jmx/scylla-jmx -l /usr/lib/scylla/jmx ${SCYLLA_PARAMS} +ExecStart=/usr/lib/scylla/jmx/scylla-jmx $SCYLLA_JMX_PORT $SCYLLA_API_PORT $SCYLLA_API_ADDR $SCYLLA_JMX_ADDR $SCYLLA_JMX_FILE $SCYLLA_JMX_LOCAL $SCYLLA_JMX_REMOTE $SCYLLA_JMX_DEBUG KillMode=process Restart=on-abnormal