From 3259ef9604e76d482dd1b0349207c6b63ad27dcc Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 16 Sep 2015 14:17:37 +0000 Subject: [PATCH] dist: move service command line to scripts/jmx_run Signed-off-by: Takuya ASADA Signed-off-by: Pekka Enberg --- dist/redhat/scripts/jmx_run | 5 +++++ dist/redhat/scylla-jmx.spec | 5 +++++ dist/redhat/sysconfig/scylla-jmx | 1 + dist/redhat/systemd/scylla-jmx.service | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 dist/redhat/scripts/jmx_run create mode 100644 dist/redhat/sysconfig/scylla-jmx diff --git a/dist/redhat/scripts/jmx_run b/dist/redhat/scripts/jmx_run new file mode 100755 index 0000000..af7d10c --- /dev/null +++ b/dist/redhat/scripts/jmx_run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +args="-Djava.net.preferIPv4Stack=true -Dcassandra.jmx.local.port=$JMX_LOCAL_PORT" + +exec /usr/bin/java -jar /usr/lib/scylla/jmx/urchin-mbean-1.0.jar $args diff --git a/dist/redhat/scylla-jmx.spec b/dist/redhat/scylla-jmx.spec index bc7ded3..da1cd34 100644 --- a/dist/redhat/scylla-jmx.spec +++ b/dist/redhat/scylla-jmx.spec @@ -24,13 +24,16 @@ env JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk mvn install %install rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ mkdir -p $RPM_BUILD_ROOT%{_unitdir} mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/scylla/ +install -m644 dist/redhat/sysconfig/scylla-jmx $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ install -m644 dist/redhat/systemd/scylla-jmx.service $RPM_BUILD_ROOT%{_unitdir}/ install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx install -m644 target/urchin-mbean-1.0.jar $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx/ +install -m755 dist/redhat/scripts/* $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx %pre /usr/sbin/groupadd scylla 2> /dev/null || : @@ -52,7 +55,9 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) +%{_sysconfdir}/sysconfig/scylla-jmx %{_unitdir}/scylla-jmx.service +%{_prefix}/lib/scylla/jmx/jmx_run %{_prefix}/lib/scylla/jmx/urchin-mbean-1.0.jar %changelog diff --git a/dist/redhat/sysconfig/scylla-jmx b/dist/redhat/sysconfig/scylla-jmx new file mode 100644 index 0000000..810a72c --- /dev/null +++ b/dist/redhat/sysconfig/scylla-jmx @@ -0,0 +1 @@ +JMX_LOCAL_PORT=7199 diff --git a/dist/redhat/systemd/scylla-jmx.service b/dist/redhat/systemd/scylla-jmx.service index bd0e2bf..fa6291f 100644 --- a/dist/redhat/systemd/scylla-jmx.service +++ b/dist/redhat/systemd/scylla-jmx.service @@ -5,9 +5,10 @@ After=scylla-server.service [Service] Type=simple +EnvironmentFile=/etc/sysconfig/scylla-jmx User=scylla Group=scylla -ExecStart=/usr/bin/java -jar /usr/lib/scylla/jmx/urchin-mbean-1.0.jar +ExecStart=/usr/lib/scylla/jmx/jmx_run KillMode=process Restart=always