I need help with Script running as a daemon !!!
Cwalinski, Zygmunt
zcwalinski at metroland.com
Tue Feb 6 02:50:16 UTC 2007
-----Original Message-----
From: Brooks Davis [mailto:brooks at freebsd.org]
Sent: 05-02-2007 9:31 PM
To: Cwalinski, Zygmunt
Cc: Brooks Davis; freebsd-rc at freebsd.org
Subject: Re: I need help with Script running as a daemon !!!
[Please don't top-post. It's considered rude on FreeBSD mailing lists.]
On Mon, Feb 05, 2007 at 07:10:28PM -0500, Cwalinski, Zygmunt wrote:
> Dave,
> Thanks for your email. I have set execute bit and change the script
to:
>
> name="runtest"
> pidfile="/var/run/${name}.pid"
> rcvar=`set_rcvar`
> start_cmd=runtest_start
> command="/etc/runtest"
> command_interpreter=while
> load_rc_config $name
> runtest_enable=${runtest_enable-:NO}
>
> runtest_start() {
> $command &
> echo $! > ${pidfile}
> }
>
> I get no error when I start this script but still when I am trying to
> stop the daemon I am getting the following error:
> runtest not running? (check /var/run/runtest.pid).
>
> (pidfile contains a correct process ID)
The value of command_interpreter is bogus. From your previous
post, it should probably be /bin/sh. That shouldn't be fatal in an of
it self though. What does "ps auxww | grep `cat /var/run/runtest.pid`"
say?
Also, what version of FreeBSD are you running?
-- Brooks
[Thanks for your top-post remark]
I am running FreeBSD 6.2
When I set "command_interpreter=/bin/sh" I get the following error
during startup:
/usr/local/etc/rc.d/runtestd: WARNING: $command_interpreter /bin/sh !=
while
(although script is running)
"ps auxww | grep `cat /var/run/runtest.pid`" says:
root 1314 0.0 1.1 1836 1396 p1 S 9:38PM 0:00.03
/bin/sh /usr/local/etc/rc.d/runtestd start
Here is my current script:
#!/bin/sh
. /etc/rc.subr
# PROVIDE: Test
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: My test
name="runtest"
pidfile="/var/run/${name}.pid"
rcvar=`set_rcvar`
start_cmd=runtest_start
command="/etc/runtest"
command_interpreter=/bin/sh
load_rc_config $name
runtest_enable=${runtest_enable-:NO}
runtest_start() {
$command &
echo $! > ${pidfile}
}
run_rc_command "$1"
Zyggi
More information about the freebsd-rc
mailing list