Date: Mon, 19 Jul 2004 22:11:15 -0500 From: Paul Schmehl <pauls@utdallas.edu> To: freebsd-questions@freebsd.org Subject: 2nd try - "new" rc script won't start on boot Message-ID: <2147483647.1090275075@[192.168.2.102]> In-Reply-To: <75EAF71C-D9F3-11D8-8AE5-0030659A531A@vvi.com> References: <20040720095650.21325cf7.y2kbug@ms25.hinet.net> <75EAF71C-D9F3-11D8-8AE5-0030659A531A@vvi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 (pauls@utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2147483647.1090275075>
