Why doesn't this startup script execute on boot?

Chuck Swiger
Thu, 13 May 2010 00:59:31 -0000

Hi--

On May 12, 2010, at 4:46 PM, Andy Dills wrote:
> I'm working on getting p0f integrated with amavisd-new. Everything is
> great, with the exception that I can't get the neccessary commands to
> execute on boot.

The amavid-p0fanalyzer script should have been installed if you used the port:

% cat /usr/local/etc/rc.d/amavis-p0fanalyzer
#!/bin/sh
# $FreeBSD: ports/security/amavisd-new/files/amavis-p0fanalyzer.sh.in,v 1.6
2007/03/30 21:52:10 gabor Exp $

# PROVIDE: amavis_p0fanalyzer
# REQUIRE: DAEMON
# BEFORE: amavisd

amavis_p0fanalyzer_enable="${amavis_p0fanalyzer_enable-NO}"
amavis_p0fanalyzer_p0f_filter="${amavis_p0fanalyzer_p0f_filter-"tcp
dst port 25"}"
amavis_p0fanalyzer_pidfile1="${amavis_p0fanalyzer_pidfile1-/var/run/p0fanalyzer1.pid}"
amavis_p0fanalyzer_pidfile2="${amavis_p0fanalyzer_pidfile2-/var/run/p0fanalyzer2.pid}"
amavis_p0f_daemon_flags="${amavis_p0f_daemon_flags--l}"
amavis_p0fanalyzer_flags="${amavis_p0fanalyzer_flags-2345}"

. /etc/rc.subr

name="amavis_p0fanalyzer"
rcvar=`set_rcvar`

start_cmd=p0fanalyzer_start
stop_cmd=p0fanalyzer_stop

p0fanalyzer_start() {
	echo "Starting p0f-analyzer." && \
	  /usr/sbin/daemon -p ${amavis_p0fanalyzer_pidfile1} \
	  /usr/local/bin/p0f ${amavis_p0f_daemon_flags} \
	  "${amavis_p0fanalyzer_p0f_filter}" 2>&1 | \
	  /usr/sbin/daemon -p ${amavis_p0fanalyzer_pidfile2} \
	  /usr/local/sbin/p0f-analyzer.pl ${amavis_p0fanalyzer_flags}
}

p0fanalyzer_stop() {
	/bin/kill `cat ${amavis_p0fanalyzer_pidfile2}` && rm
${amavis_p0fanalyzer_pidfile2}
	/bin/kill `cat ${amavis_p0fanalyzer_pidfile1}` && rm
${amavis_p0fanalyzer_pidfile1}
}

load_rc_config $name
run_rc_command "$1"

Regards,
--
-Chuck