2022-05-14 11:33:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# mynettcptable/files/mynettcptable.in 2022-05-13 09:04:03Z yo $
|
|
|
|
#
|
|
|
|
# PROVIDE: mynettcptable
|
|
|
|
# REQUIRE: DAEMON
|
|
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
|
|
# mynettcptable_enable (bool): Set to "YES" to enable mynettcptable.
|
|
|
|
# (default: "NO")
|
|
|
|
#
|
|
|
|
# mynettcptable_config (str): Configuration file.
|
|
|
|
# (default: "/usr/local/etc/mynettcptable.conf")
|
|
|
|
#
|
|
|
|
# mynettcptable_loglevel (str): Log level
|
|
|
|
# (default: "warn")
|
|
|
|
#
|
|
|
|
# mynettcptable_logfile (str): MyNetTCPTable logfile
|
|
|
|
# (default: "/var/log/mynettcptable.log")
|
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name=mynettcptable
|
|
|
|
rcvar=mynettcptable_enable
|
|
|
|
|
2022-05-17 13:44:30 +02:00
|
|
|
load_rc_config ${name}
|
2022-05-14 11:33:22 +02:00
|
|
|
|
|
|
|
: ${mynettcptable_enable="NO"}
|
|
|
|
: ${mynettcptable_config="/usr/local/etc/mynettcptable.conf"}
|
|
|
|
: ${mynettcptable_loglevel="warn"}
|
2022-05-16 10:50:52 +02:00
|
|
|
: ${mynettcptable_user:="nobody"}
|
2022-05-14 11:33:22 +02:00
|
|
|
: ${mynettcptable_logfile="/var/log/mynettcptable.log"}
|
|
|
|
|
2022-05-17 13:44:30 +02:00
|
|
|
command="/usr/local/bin/${name}"
|
2022-05-16 10:50:52 +02:00
|
|
|
pidfile="/var/run/${name}/${name}.pid"
|
2022-05-17 13:44:30 +02:00
|
|
|
command_args="-pidfile=${pidfile} -config=${mynettcptable_config} -logLevel=${mynettcptable_loglevel}"
|
2022-05-16 10:50:52 +02:00
|
|
|
|
|
|
|
start_precmd="mynettcptable_prestart"
|
2022-05-17 13:44:30 +02:00
|
|
|
|
|
|
|
start_cmd="/usr/sbin/daemon -u ${mynettcptable_user} ${command} ${command_args} >> ${mynettcptable_logfile} 2>&1"
|
2022-05-16 10:50:52 +02:00
|
|
|
|
|
|
|
mynettcptable_prestart()
|
|
|
|
{
|
|
|
|
mkdir /var/run/${name} >/dev/null 2>&1
|
|
|
|
touch ${mynettcptable_logfile}
|
|
|
|
chown ${mynettcptable_user} /var/run/${name}
|
|
|
|
chown ${mynettcptable_user} ${mynettcptable_logfile}
|
|
|
|
}
|
2022-05-14 11:33:22 +02:00
|
|
|
|
|
|
|
run_rc_command "$1"
|
2022-05-16 10:50:52 +02:00
|
|
|
|