I've written a very simple rc script, using the "new" method, and the script works fine (start|stop|restart|rcvar|status|poll|) except for one thing. It won't start the daemon when the server is rebooted. I'm wondering if anyone might be able to help me.

Here's the details

1) FreeBSD 4.8 RELEASE, 450 MHz processor, 128 MB ram

2) rc script permissions:

ls -lsa /usr/local/etc/rc.d/extractor.sh
2 -rwxr-x--- 1 root wheel 1154 Jul 17 01:07 /usr/local/etc/rc.d/extractor.sh


3) rc script:

head /usr/local/etc/rc.d/extractor.sh

#!/bin/sh
# $Id$

# PROVIDE: extractor
# BEFORE:  LOGIN
# KEYWORD: FreeBSD


. /usr/local/etc/rc.subr

name=extractor
rcvar=`set_rcvar`

command="/usr/local/bin/${name}"

load_rc_config $name
run_rc_command "$1"

4) rc script enabled?

bash-2.05b# /usr/local/etc/rc.d/extractor.sh rcvar
# extractor
$extractor_enable=YES

As you can see, the script is enabled in /etc/rc.conf. But it absolutely won't start. There are no error messages in /var/log/messages or in the daelmon's log, and the daemon doesn't allow me to set a verbose or debug mode that would give me more information.

I've written a small cron script to make sure the daemon stays running, and I'm using that now to start the daemon after rebooting, but obviously I'd prefer to do it the right way.

Here's the cron script:

#!/bin/sh

/usr/local/etc/rc.d/extractor.sh status > test1
sed -e 's/\.//g' test1 > test2
PID=`awk '/extractor/ {print $6}' test2`
if [ $PID > 0 ]; then
 exit 0
else
 echo "Extractor was not running."
 /usr/local/etc/rc.d/extractor.sh start
fi

This works to start the daemon after a reboot (and if it should ever stop running, but I'd prefer to have it start up properly.

Anyone have any ideas what might be causing this? This is the first script I've ever written using the rc.subr system, so it could be something very simple that I missed in the docs.

Paul Schmehl ([EMAIL PROTECTED])
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to