#!/bin/sh # PROVIDE: ourmon # REQUIRE: LOGIN # # Add the follow line to /etc/rc.conf to enable ourmon: # ourmon_enable (bool): Set it to "YES" to enable ourmon. # Default is "NO". # ourmon_flags (str): Flags passed to ourmon-script on startup. # Default is "-a 30 -s 256 -f # /usr/local/mrourmon/etc/ourmon.conf -i re0 -D /usr/local/mrourmon/tmp" # # The sysctl variables exist to reduce dropped packets. # NOTE: on BSD, you may need a recent version of libpcap for this to work # get it from: www.tcpdump.org. # On BSD: compare sysctl -a outputs to /var/log/messages, bpf bufsizes should match! . %%RC_SUBR%% name="ourmon" rcvar=${name}_enable command="%%PREFIX%%/mrourmon/bin/ourmon" load_rc_config $name : ${ourmon_enable="NO"} : ${ourmon_flags="-a 30 -s 256 -f /usr/local/mrourmon/etc/ourmon.conf -i re0 -D /usr/local/mrourmon/tmp"} start_cmd=${name}_start ourmon_start () { sysctl -w net.bpf_bufsize=8388608 sysctl -w net.bpf_maxbufsize=8388608 echo "Starting ourmon." ${command} ${ourmon_flags} } ourmon_stop () { echo "Stopping ourmon." kill -9 `cat /var/run/ourmon.pid` } ourmon_restart () { echo "Restarting ourmon." ourmon_stop ourmon_start } command_args="$ourmon_flags" run_rc_command "$1"