mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-12 03:00:28 +00:00
Redirect all output to syslog by means of daemon(8) having syslog support
in recent FreeBSD versions and by means of piping it to logger(1) for previous FreeBSD versions: add influxd_facility and influxd_priority variables (defaults to daemon.info). Bump PORTREVISION. PR: 221960 Submitted by: Sascha Holzleiter Approved by: cheffo (maintainer)
This commit is contained in:
parent
6c51d8b8c4
commit
1f8dc4f6a7
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=449830
@ -3,6 +3,7 @@
|
||||
PORTNAME= influxdb
|
||||
PORTVERSION= 1.3.3
|
||||
DISTVERSIONPREFIX= v
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= databases net-mgmt
|
||||
|
||||
MAINTAINER= cheffo@freebsd-bg.org
|
||||
@ -72,6 +73,15 @@ INFLUXD_DBDIR= /var/db/${PORTNAME}/
|
||||
INFLUXD_LOGDIR= /var/log/${PORTNAME}/
|
||||
INFLUXD_PIDDIR= /var/run/${PORTNAME}/
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OPSYS} == "FreeBSD" && ((${OSVERSION} >= 1100513 && ${OSVERSION} < 1200000) || \
|
||||
${OSVERSION} >= 1200015)
|
||||
SUB_LIST+= INFLUXD_LOGCMD="daemon"
|
||||
.else
|
||||
SUB_LIST+= INFLUXD_LOGCMD="logger"
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${MKDIR} ${WRKSRC}/src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME}
|
||||
@cd ${WRKSRC} && \
|
||||
@ -115,4 +125,4 @@ do-install-MANPAGES-on:
|
||||
${INSTALL_MAN} ${WRKSRC}/src/github.com/influxdata/influxdb/man/$i ${STAGEDIR}${MAN8PREFIX}/man/man1
|
||||
.endfor
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
@ -18,6 +18,11 @@
|
||||
# influxd_group (str): influxd daemon group
|
||||
# Default: influxd
|
||||
# influxd_flags (str): Extra flags passed to influxd
|
||||
#
|
||||
# influxd_facility (str): Syslog facility to use
|
||||
# Default: daemon
|
||||
# influxd_priority (str): Syslog priority to use
|
||||
# Default: info
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
@ -29,19 +34,35 @@ load_rc_config $name
|
||||
: ${influxd_user:="%%INFLUXD_USER%%"}
|
||||
: ${influxd_group:="%%INFLUXD_GROUP%%"}
|
||||
: ${influxd_flags:=""}
|
||||
: ${influxd_facility:="daemon"}
|
||||
: ${influxd_priority:="info"}
|
||||
: ${influxd_conf:="%%PREFIX%%/etc/${name}.conf"}
|
||||
: ${influxd_options:="${influxdb_flags} -config=${influxd_conf} 2> %%INFLUXD_LOGDIR%%/influxdb.log"}
|
||||
: ${influxd_options:="${influxdb_flags} -config=${influxd_conf}"}
|
||||
|
||||
# daemon
|
||||
influxd_pidfile="%%INFLUXD_PIDDIR%%${name}.pid"
|
||||
procname="%%PREFIX%%/bin/${name}"
|
||||
command=/usr/sbin/daemon
|
||||
command_args="-c -p ${influxd_pidfile} ${procname} ${influxd_options}"
|
||||
start_precmd="influxd_precmd"
|
||||
start_cmd="influxd_startcmd_%%INFLUXD_LOGCMD%%"
|
||||
|
||||
influxd_precmd()
|
||||
{
|
||||
install -d -o ${influxd_user} %%INFLUXD_PIDDIR%%
|
||||
}
|
||||
|
||||
influxd_startcmd_daemon()
|
||||
{
|
||||
echo "Starting ${name}."
|
||||
/usr/sbin/daemon -c -p ${influxd_pidfile} -S -s ${influxd_priority} -l ${influxd_facility} \
|
||||
-u ${influxd_user} ${procname} ${influxd_options}
|
||||
}
|
||||
|
||||
influxd_startcmd_logger()
|
||||
{
|
||||
echo "Starting ${name}."
|
||||
/usr/sbin/daemon -c -p ${influxd_pidfile} -u ${influxd_user} /bin/sh -c "${procname} ${influxd_options} 2>&1 \
|
||||
| /usr/bin/logger -t ${name} -p ${influxd_facility}.${influxd_priority}"
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
||||
|
Loading…
Reference in New Issue
Block a user