net-mgmt/metronome: Add rc.d script

PR:		239819
Reported by:	freebsd_at_dns_d_company, tremere_at_cainites_d_net
main
Kirill Ponomarev 2024-05-18 07:15:28 +02:00
parent 492c3dfbea
commit 9ae1e22950
5 changed files with 54 additions and 4 deletions

2
GIDs
View File

@ -285,7 +285,7 @@ stunnel:*:341:
openfire:*:342:
gunicorn:*:343:
snmpd:*:344:
# free: 345
_metronome:*:345:
# free: 346
eturnal:*:347:
# free: 348

2
UIDs
View File

@ -290,7 +290,7 @@ stunnel:*:341:341::0:0:Stunnel Daemon:/nonexistent:/usr/sbin/nologin
openfire:*:342:342::0:0:Openfire IM Daemon:/nonexistent:/usr/sbin/nologin
gunicorn:*:343:343::0:0:Gunicorn Daemon:/nonexistent:/usr/sbin/nologin
snmpd:*:344:344::0:0:Net-SNMP Daemon:/nonexistent:/usr/sbin/nologin
# free: 345
_metronome:*:345:345::0:0:Metronome Daemon:/nonexistent:/usr/sbin/nologin
# free: 346
eturnal:*:347:347::0:0:eturnal User:/var/spool/eturnal:/bin/sh
# free: 348

View File

@ -1,6 +1,6 @@
PORTNAME= metronome
DISTVERSION= 0.9.0
PORTREVISION= 20
PORTREVISION= 21
CATEGORIES= net-mgmt dns
MAINTAINER= krion@FreeBSD.org
@ -13,21 +13,35 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libboost_thread.so:devel/boost-libs
USES= autoreconf:build compiler:c++11-lang eigen:3 libtool:build \
localbase:ldflags pathfix pkgconfig
localbase:ldflags pathfix pkgconfig
USE_CXXSTD= c++14
USE_GITHUB= yes
GH_ACCOUNT= ahupowerdns
USE_LDCONFIG= yes
USE_RC_SUBR= metronome
GNU_CONFIGURE= yes
INSTALL_TARGET= install-strip
SUB_FILES= pkg-message
SUB_LIST+= METRONOME_DBDIR=${METRONOME_DBDIR} \
METRONOME_USER=${METRONOME_USER}
METRONOME_USER?= _metronome
USERS= ${METRONOME_USER}
GROUPS= ${METRONOME_USER}
PLIST_SUB+= METRONOME_DBDIR=${METRONOME_DBDIR} \
METRONOME_USER=${METRONOME_USER}
OPTIONS_DEFINE= DOCS
METRONOME_DBDIR?= /var/db/metronome
pre-configure:
(cd ${WRKSRC}; ./bootstrap )
post-install:
${MKDIR} ${STAGEDIR}${METRONOME_DBDIR}
.include <bsd.port.mk>

View File

@ -0,0 +1,35 @@
#!/bin/sh
# PROVIDE: metronome
# REQUIRE: DAEMON SERVERS
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable metronome:
#
# metronome_enable="YES"
#
# The next lines are optional since they have defaults
#
# metronome_carbonaddress="<set as needed>"
# metronome_wsaddress="<set as needed>"
# metronome_statsdir="<set as needed>"
#
. /etc/rc.subr
name=metronome
rcvar=${name}_enable
load_rc_config ${name}
: ${metronome_enable:=NO}
: ${metronome_carbonaddress:=127.0.0.1:2003}
: ${metronome_wsaddress:=127.0.0.1:8000}
: ${metronome_statsdir:=%%METRONOME_DBDIR%%}
pidfile=/var/run/${name}.pid
actual_command="%%PREFIX%%/bin/${name} --daemon 0 --carbon-address ${metronome_carbonaddress} --webserver-address ${metronome_wsaddress} --stats-directory ${metronome_statsdir}"
command=/usr/sbin/daemon
command_args="-c -f -r -u %%METRONOME_USER%% -P ${pidfile} -- ${actual_command}"
run_rc_command "$1"

View File

@ -18,3 +18,4 @@ bin/msubmit
%%DATADIR%%/html/legend.css
%%DATADIR%%/html/lines.css
%%DATADIR%%/html/local.js
@dir(%%METRONOME_USER%%, %%METRONOME_USER%%, ) %%METRONOME_DBDIR%%