Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Feb 2007 21:33:46 -0600
From:      Brooks Davis <brooks@freebsd.org>
To:        "Cwalinski, Zygmunt" <zcwalinski@metroland.com>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: I need help with Script running as a daemon !!!
Message-ID:  <20070206033346.GC55215@lor.one-eyed-alien.net>
In-Reply-To: <5CD1A0226571E74A830A15192855981801964470@CSYS-EVS01.corp.metroland.com>
References:  <5CD1A0226571E74A830A15192855981801964470@CSYS-EVS01.corp.metroland.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--zCKi3GIZzVBPywwA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Feb 05, 2007 at 09:50:08PM -0500, Cwalinski, Zygmunt wrote:
> -----Original Message-----
> From: Brooks Davis [mailto:brooks@freebsd.org]=20
> Sent: 05-02-2007 9:31 PM
> To: Cwalinski, Zygmunt
> Cc: Brooks Davis; freebsd-rc@freebsd.org
> Subject: Re: I need help with Script running as a daemon !!!
>=20
> [Please don't top-post.  It's considered rude on FreeBSD mailing lists.]
>=20
> On Mon, Feb 05, 2007 at 07:10:28PM -0500, Cwalinski, Zygmunt wrote:
> > Dave,=20
> > Thanks for your email. I have set execute bit and change the script
> to:
> >=20
> > name=3D"runtest"
> > pidfile=3D"/var/run/${name}.pid"
> > rcvar=3D`set_rcvar`
> > start_cmd=3Druntest_start
> > command=3D"/etc/runtest"
> > command_interpreter=3Dwhile
> > load_rc_config $name
> > runtest_enable=3D${runtest_enable-:NO}
> >=20
> > runtest_start() {
> >   $command &
> >   echo $! > ${pidfile}
> > }
> >=20
> > 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).
> >=20
> > (pidfile contains a correct process ID)
>=20
> 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?
>=20
> Also, what version of FreeBSD are you running?
>=20
> -- Brooks
>=20
> [Thanks for your top-post remark]
> I am running FreeBSD 6.2
>=20
> When I set "command_interpreter=3D/bin/sh" I get the following error
> during startup:
> /usr/local/etc/rc.d/runtestd: WARNING: $command_interpreter /bin/sh !=3D
> while
> (although script is running)
>=20
> "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
>=20
> Here is my current script:
> #!/bin/sh
> . /etc/rc.subr
> # PROVIDE: Test
> # REQUIRE: DAEMON
> # BEFORE: LOGIN
> # KEYWORD: My test
> name=3D"runtest"
> pidfile=3D"/var/run/${name}.pid"
> rcvar=3D`set_rcvar`
> start_cmd=3Druntest_start
> command=3D"/etc/runtest"
> command_interpreter=3D/bin/sh
>=20
> load_rc_config $name
> runtest_enable=3D${runtest_enable-:NO}
>=20
> runtest_start() {
>   $command &
>   echo $! > ${pidfile}
> }
> run_rc_command "$1"

If this is the output then /usr/local/etc/rc.d/runtestd should be
command since that's what is actually being run.  What is /etc/runtest?
A symlink?

-- Brooks

--zCKi3GIZzVBPywwA
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQFFx/cZXY6L6fI4GtQRAvu9AKDJp5WdBW9lDn5hshJ3RRVQPPcQcwCfSB+H
j0HGw1vSRjAvHIDknOhGRWY=
=Yl7X
-----END PGP SIGNATURE-----

--zCKi3GIZzVBPywwA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070206033346.GC55215>