pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/grafana grafana: fix rc.d script pidfile handling



details:   https://anonhg.NetBSD.org/pkgsrc/rev/87fe97cf9343
branches:  trunk
changeset: 399089:87fe97cf9343
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Fri Aug 02 13:23:51 2019 +0000

description:
grafana: fix rc.d script pidfile handling

>From Marc Baudoin.
Bump.

diffstat:

 www/grafana/Makefile         |   3 ++-
 www/grafana/files/grafana.sh |  11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 808ea8f0c9d5 -r 87fe97cf9343 www/grafana/Makefile
--- a/www/grafana/Makefile      Fri Aug 02 11:48:17 2019 +0000
+++ b/www/grafana/Makefile      Fri Aug 02 13:23:51 2019 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.13 2019/06/06 16:09:19 adam Exp $
+# $NetBSD: Makefile,v 1.14 2019/08/02 13:23:51 tnn Exp $
 
 DISTNAME=      grafana-6.2.2
+PKGREVISION=   1
 CATEGORIES=    www
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=grafana/}
 GITHUB_TAG=    v${PKGVERSION_NOREV}
diff -r 808ea8f0c9d5 -r 87fe97cf9343 www/grafana/files/grafana.sh
--- a/www/grafana/files/grafana.sh      Fri Aug 02 11:48:17 2019 +0000
+++ b/www/grafana/files/grafana.sh      Fri Aug 02 13:23:51 2019 +0000
@@ -16,6 +16,15 @@
 pidfile="@VARBASE@/run/${name}.pid"
 command="@PREFIX@/bin/grafana-server"
 command_args="-homepath ${grafana_home} -config @PKG_SYSCONFDIR@/grafana.conf -pidfile ${pidfile} < /dev/null > /dev/null 2>&1 &"
+start_precmd="grafana_precmd"
+
+grafana_precmd() {
+       if [ ! -r "${pidfile}" ]; then
+               touch "${pidfile}"
+               chown "${grafana_user}:${grafana_group}" "${pidfile}"
+               chmod 644 "${pidfile}"
+       fi
+}
 
 if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
        load_rc_config $name
@@ -36,7 +45,7 @@
        stop)
                if [ -r "${pidfile}" ]; then
                        @ECHO@ "Stopping ${name}."
-                       kill `@CAT@ ${pidfile}` && @RM@ ${pidfile}
+                       kill `@CAT@ "${pidfile}"` && @RM@ "${pidfile}"
                fi
                ;;
        *)



Home | Main Index | Thread Index | Old Index