Index: head/net-mgmt/grok_exporter/Makefile =================================================================== --- head/net-mgmt/grok_exporter/Makefile (revision 466545) +++ head/net-mgmt/grok_exporter/Makefile (revision 466546) @@ -1,39 +1,42 @@ # $FreeBSD$ PORTNAME= grok_exporter PORTVERSION= 0.2.3 DISTVERSIONPREFIX=v +PORTREVISION= 1 CATEGORIES= net-mgmt MAINTAINER= gasol.wu@gmail.com COMMENT= Export Prometheus metrics from arbitrary unstructured log data LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE ONLY_FOR_ARCHS= amd64 LIB_DEPENDS= libonig.so:devel/oniguruma USES= go USE_GITHUB= yes GH_ACCOUNT= fstab logstash-plugins:plugins GH_PROJECT= logstash-patterns-core:plugins GH_TAGNAME= 6d25c13:plugins +USERS= prometheus +GROUPS= prometheus GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} USE_RC_SUBR= grok_exporter SUB_FILES= config.yml do-build: ${LN} -sf ${WRKSRC}/tailer/fileTailer_darwin.go ${WRKSRC}/tailer/fileTailer_freebsd.go @(cd ${GO_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build -o ${PORTNAME} .) do-install: ${INSTALL_PROGRAM} ${GO_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME} ${MKDIR} ${STAGEDIR}${ETCDIR} ${INSTALL_DATA} ${WRKDIR}/config.yml ${STAGEDIR}${ETCDIR} @(cd ${WRKSRC} && ${COPYTREE_SHARE} example ${STAGEDIR}${DATADIR}) @(cd ${WRKSRC_plugins} && ${COPYTREE_SHARE} patterns ${STAGEDIR}${DATADIR}) .include Index: head/net-mgmt/grok_exporter/files/grok_exporter.in =================================================================== --- head/net-mgmt/grok_exporter/files/grok_exporter.in (revision 466545) +++ head/net-mgmt/grok_exporter/files/grok_exporter.in (revision 466546) @@ -1,47 +1,49 @@ #!/bin/sh # $FreeBSD$ # PROVIDE: grok_exporter # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # grok_exporter_enable (bool): Set to NO by default. # Set it to YES to enable grok_exporter. # grok_exporter_config (string): Set path to config file # Default is "%%ETCDIR%%/config.yml". # grok_exporter_user (string): Set user that grok_exporter will run under -# Default is "nobody". +# Default is "prometheus". # grok_exporter_group (string): Set group that grok_exporter will run under -# Default is "nobody". +# Default is "prometheus". . /etc/rc.subr name=grok_exporter desc="Grok prometheus exporter" rcvar=grok_exporter_enable load_rc_config $name : ${grok_exporter_enable:=NO} : ${grok_exporter_config:=%%ETCDIR%%/config.yml} -: ${grok_exporter_user:=nobody} -: ${grok_exporter_group:=nobody} +: ${grok_exporter_user:=prometheus} +: ${grok_exporter_group:=prometheus} pidfile=/var/run/grok_exporter.pid command=/usr/sbin/daemon procname=%%PREFIX%%/bin/grok_exporter command_args="-p ${pidfile} /usr/bin/env ${procname} -config ${grok_exporter_config}" start_precmd=grok_exporter_startprecmd grok_exporter_startprecmd() { - if [ ! -e ${pidfile} ]; then + if [ -e ${pidfile} ]; then + chown ${grok_exporter_user}:${grok_exporter_group} ${pidfile}; + else install -o ${grok_exporter_user} -g ${grok_exporter_group} /dev/null ${pidfile}; fi } run_rc_command "$1"