mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
Whoops. Add the rcNG script itself.
This commit is contained in:
parent
71c1e14887
commit
3461087fc9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=95639
54
net-mgmt/trafd/files/trafd.sh.sample
Normal file
54
net-mgmt/trafd/files/trafd.sh.sample
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# PROVIDE: trafd
|
||||
# REQUIRE: netif routing
|
||||
# KEYWORD: FreeBSD shutdown
|
||||
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf to enable trafd:
|
||||
#
|
||||
#trafd_enable="YES"
|
||||
#trafd_ifaces="fxp0 fxp1 fxp2"
|
||||
#trafd_flags=""
|
||||
#trafd_log="/var/log/traffic.log"
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="trafd"
|
||||
rcvar=`set_rcvar`
|
||||
command="/usr/local/bin/trafd"
|
||||
start_cmd="trafd_start"
|
||||
stop_cmd="trafd_stop"
|
||||
|
||||
trafd_enable=${trafd_enable:-"NO"}
|
||||
trafd_log=${trafd_log:-"/var/log/traffic.log"}
|
||||
load_rc_config $name
|
||||
|
||||
trafd_start()
|
||||
{
|
||||
echo 'Starting trafd.'
|
||||
if checkyesno ${rcvar} && [ "x${trafd_ifaces}" != "x" ]; then
|
||||
for iface in ${trafd_ifaces}; do
|
||||
${command} -i ${iface} ${trafd_flags}
|
||||
done
|
||||
else
|
||||
warn '$trafd_ifaces is not set.'
|
||||
fi
|
||||
}
|
||||
|
||||
trafd_stop()
|
||||
{
|
||||
echo 'Stopping trafd.'
|
||||
for iface in ${trafd_ifaces}; do
|
||||
read rc_pid < /var/run/trafd.$iface
|
||||
if [ -n "${rc_pid}" ]; then
|
||||
kill -TERM ${rc_pid}
|
||||
wait_for_pids ${rc_pid}
|
||||
echo "$(date +"%b %e %H:%M:%S") $(hostname -s) trafstop:" "'('${iface}')' signaling to shutdown" >> ${trafd_log}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
54
net/trafd/files/trafd.sh.sample
Normal file
54
net/trafd/files/trafd.sh.sample
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# PROVIDE: trafd
|
||||
# REQUIRE: netif routing
|
||||
# KEYWORD: FreeBSD shutdown
|
||||
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf to enable trafd:
|
||||
#
|
||||
#trafd_enable="YES"
|
||||
#trafd_ifaces="fxp0 fxp1 fxp2"
|
||||
#trafd_flags=""
|
||||
#trafd_log="/var/log/traffic.log"
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="trafd"
|
||||
rcvar=`set_rcvar`
|
||||
command="/usr/local/bin/trafd"
|
||||
start_cmd="trafd_start"
|
||||
stop_cmd="trafd_stop"
|
||||
|
||||
trafd_enable=${trafd_enable:-"NO"}
|
||||
trafd_log=${trafd_log:-"/var/log/traffic.log"}
|
||||
load_rc_config $name
|
||||
|
||||
trafd_start()
|
||||
{
|
||||
echo 'Starting trafd.'
|
||||
if checkyesno ${rcvar} && [ "x${trafd_ifaces}" != "x" ]; then
|
||||
for iface in ${trafd_ifaces}; do
|
||||
${command} -i ${iface} ${trafd_flags}
|
||||
done
|
||||
else
|
||||
warn '$trafd_ifaces is not set.'
|
||||
fi
|
||||
}
|
||||
|
||||
trafd_stop()
|
||||
{
|
||||
echo 'Stopping trafd.'
|
||||
for iface in ${trafd_ifaces}; do
|
||||
read rc_pid < /var/run/trafd.$iface
|
||||
if [ -n "${rc_pid}" ]; then
|
||||
kill -TERM ${rc_pid}
|
||||
wait_for_pids ${rc_pid}
|
||||
echo "$(date +"%b %e %H:%M:%S") $(hostname -s) trafstop:" "'('${iface}')' signaling to shutdown" >> ${trafd_log}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
Loading…
Reference in New Issue
Block a user