Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Dec 2015 10:27:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 204988] net-mgmt/riemann startup script doesn't work if more than one java process is running
Message-ID:  <bug-204988-13-NU48JBVJTV@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-204988-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-204988-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204988

Davide D'Amico <davide.damico@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #163804|0                           |1
        is obsolete|                            |

--- Comment #1 from Davide D'Amico <davide.damico@gmail.com> ---
Comment on attachment 163804
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=163804
Riemann startup script patch

>diff -ruh riemann.orig/files/riemann.in riemann/files/riemann.in
>--- riemann.orig/files/riemann.in       2015-02-27 14:35:09.000000000 -0500
>+++ riemann/files/riemann.in    2015-12-03 03:36:46.418837000 -0500
>@@ -28,11 +28,11 @@
> load_rc_config $name
>
> : ${riemann_enable="NO"}
>-: ${riemann_user:="%%RIEMANN_USER%%"}
>-: ${riemann_group:="%%RIEMANN_GROUP%%"}
>-: ${riemann_config:="%%PREFIX%%/etc/riemann/riemann.config.sample"}
>-: ${riemann_jarfile:="%%JAVAJARDIR%%/riemann.jar"}
>-: ${riemann_java_home:="%%JAVA_HOME%%"}
>+: ${riemann_user:="riemann"}
>+: ${riemann_group:="riemann"}
>+: ${riemann_config:="/usr/local/etc/riemann/riemann.config.sample"}
>+: ${riemann_jarfile:="/usr/local/share/java/classes/riemann.jar"}
>+: ${riemann_java_home:="/usr/local/openjdk7"}
> : ${riemann_min_mem:="256m"}
> : ${riemann_max_mem:="1g"}
> : ${riemann_java_opts:=" -server \
>@@ -53,12 +53,15 @@
>         -XX:+UseParNewGC \
>         -XX:CMSInitiatingOccupancyFraction=75 "}
>
>-riemann_pidfile="%%RIEMANN_PIDDIR%%${name}.pid"
>+riemann_pidfile="/var/run/riemann/${name}.pid"
> command="/usr/sbin/daemon"
> procname="${riemann_java_home}/bin/java"
> command_args="-f -c -p ${riemann_pidfile} ${procname} ${riemann_java_opts} \
>     -jar ${riemann_jarfile} ${riemann_config}"
> required_files="${java_cmd} ${riemann_config}"
>+status_cmd="riemann_status"
>+start_cmd="riemann_start"
>+stop_cmd="riemann_stop"
>
> riemann_prestart()
> {
>@@ -66,4 +69,72 @@
> }
> start_precmd=${name}_prestart
>
>+riemann_start()
>+{
>+    check_if_running=$(/usr/local/bin/jps | grep ${name} | awk '{print $1}')
>+    if [ ! -z "${check_if_running}" ]; then
>+        echo "${name} seems running (pid: ${check_if_running})."
>+        return 1
>+    fi
>+
>+    rc_pid=$(riemann_check_pidfile $riemann_pidfile)
>+    if [ -z "$rc_pid" ]; then
>+        echo "Starting ${name}."
>+        ${command} ${command_args}
>+    else
>+        echo "${name} seems running ($rc_pid)."
>+        return 1
>+    fi
>+
>+}
>+
>+riemann_status()
>+{
>+        rc_pid=$(riemann_check_pidfile $riemann_pidfile)
>+
>+        if [ -z "$rc_pid" ]; then
>+                [ -n "$rc_fast" ] && return 0
>+                echo "${name} not running? (check $riemann_pidfile)."
>+                return 1
>+        fi
>+        echo "${name} is running as pid ${rc_pid}."
>+}
>+
>+riemann_check_pidfile()
>+{
>+        _pidfile=$1
>+        if [ -z "$_pidfile" ]; then
>+                err 3 'USAGE: riemann_check_pidfile pidfile'
>+        fi
>+        if [ ! -f $_pidfile ]; then
>+                debug "pid file ($_pidfile): not readable."
>+                return
>+        fi
>+        read _pid _junk < $_pidfile
>+        if [ -z "$_pid" ]; then
>+                debug "pid file ($_pidfile): no pid in file."
>+                return
>+        fi
>+        if [ -n "`/usr/local/bin/jps -l | grep -e "^$_pid"`" ]; then
>+                echo -n $_pid
>+        fi
>+}
>+
>+riemann_stop()
>+{
>+        rc_pid=$(riemann_check_pidfile $riemann_pidfile)
>+
>+        if [ -z "$rc_pid" ]; then
>+                [ -n "$rc_fast" ] && return 0
>+                echo "${name} not running? (check $riemann_pidfile)."
>+                return 1
>+        fi
>+
>+        echo "Stopping ${name}."
>+        kill ${rc_pid} 2> /dev/null
>+}
>+
>+
>+
>+
> run_rc_command "$1"

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-204988-13-NU48JBVJTV>