Skip to content

Commit

Permalink
net-mgmt/metronome: Add rc.d script
Browse files Browse the repository at this point in the history
PR:		239819
Reported by:	freebsd_at_dns_d_company, tremere_at_cainites_d_net
  • Loading branch information
krionbsd committed May 18, 2024
1 parent 492c3df commit 9ae1e22
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GIDs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ stunnel:*:341:
openfire:*:342:
gunicorn:*:343:
snmpd:*:344:
# free: 345
_metronome:*:345:
# free: 346
eturnal:*:347:
# free: 348
Expand Down
2 changes: 1 addition & 1 deletion UIDs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions net-mgmt/metronome/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PORTNAME= metronome
DISTVERSION= 0.9.0
PORTREVISION= 20
PORTREVISION= 21
CATEGORIES= net-mgmt dns

MAINTAINER= krion@FreeBSD.org
Expand All @@ -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>
35 changes: 35 additions & 0 deletions net-mgmt/metronome/files/metronome.in
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions net-mgmt/metronome/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -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%%

0 comments on commit 9ae1e22

Please sign in to comment.