git: 0f166ee9896b - main - net/tcplog_dumper: Add a RC script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Jan 2023 23:18:59 UTC
The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/ports/commit/?id=0f166ee9896b4f6ab6b311fb716f64819f729745 commit 0f166ee9896b4f6ab6b311fb716f64819f729745 Author: Olivier Cochard <olivier@FreeBSD.org> AuthorDate: 2023-01-02 23:16:27 +0000 Commit: Olivier Cochard <olivier@FreeBSD.org> CommitDate: 2023-01-02 23:18:10 +0000 net/tcplog_dumper: Add a RC script Obtained from: tuexen Sponsored by: Netflix --- net/tcplog_dumper/Makefile | 3 +++ net/tcplog_dumper/files/tcplog_dumper.in | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/net/tcplog_dumper/Makefile b/net/tcplog_dumper/Makefile index 4a41b420a801..261db29afb77 100644 --- a/net/tcplog_dumper/Makefile +++ b/net/tcplog_dumper/Makefile @@ -1,6 +1,7 @@ PORTNAME= tcplog_dumper PORTVERSION= 0.1.1 DISTVERSIONPREFIX= v +PORTREVISION= 1 CATEGORIES= net MAINTAINER= olivier@FreeBSD.org @@ -16,6 +17,8 @@ ONLY_FOR_ARCHS_REASON= only 64-bit platforms are supported USE_GITHUB= yes GH_ACCOUNT= Netflix +USE_RC_SUBR= tcplog_dumper + PLIST_FILES= sbin/tcplog_dumper \ man/man1/tcplog_dumper.1.gz diff --git a/net/tcplog_dumper/files/tcplog_dumper.in b/net/tcplog_dumper/files/tcplog_dumper.in new file mode 100644 index 000000000000..ccab36820af8 --- /dev/null +++ b/net/tcplog_dumper/files/tcplog_dumper.in @@ -0,0 +1,44 @@ +#!/bin/sh + +# PROVIDE: tcplog_dumper +# REQUIRE: DAEMON +# KEYWORD: shutdown + +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# tcplog_dumper_enable (bool): Set to NO by default. +# Set it to YES to enable tcplog_dumper. +# tcplog_dumper_pidfile (file): Set to /var/run/tcplog_dumper.pid by default. +# tcplog_dumper_basedir (path): Set to /var/log/tcplog_dumps by default. +# tcplog_dumper_basedir_owner: Set to nobody by default. + +. /etc/rc.subr + +name=tcplog_dumper +rcvar=tcplog_dumper_enable + +load_rc_config ${name} + +: ${tcplog_dumper_enable:=NO} +: ${tcplog_dumper_pidfile=/var/run/${name}.pid} +: ${tcplog_dumper_basedir=/var/log/tcplog_dumps} +: ${tcplog_dumper_basedir_owner=nobody} + +command="%%PREFIX%%/sbin/${name}" +command_args="-d -D ${tcplog_dumper_basedir} -u ${tcplog_dumper_basedir_owner} -p ${tcplog_dumper_pidfile}" + +pidfile="${tcplog_dumper_pidfile}" +start_precmd="${name}_prestart" + +tcplog_dumper_prestart() +{ + if [ ! -d "${tcplog_dumper_basedir}" ]; then + mkdir -p "${tcplog_dumper_basedir}" + fi + if [ ! "x$(stat -f '%Su' ${tcplog_dumper_basedir})" = "x${tcplog_dumper_basedir_owner}" ] ; then + chown "${tcplog_dumper_basedir_owner}" "${tcplog_dumper_basedir}" + fi +} + +run_rc_command "$1"