From owner-freebsd-rc@FreeBSD.ORG Tue Feb 6 02:50:16 2007 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C42C16A400; Tue, 6 Feb 2007 02:50:16 +0000 (UTC) (envelope-from zcwalinski@metroland.com) Received: from server05.metroland.com (server05.metroland.com [192.206.149.20]) by mx1.freebsd.org (Postfix) with ESMTP id E3A7513C428; Tue, 6 Feb 2007 02:50:07 +0000 (UTC) (envelope-from zcwalinski@metroland.com) Received: from server06.metroland.com (tem-xchange-srv.tem.metroland.com [66.207.103.173] (may be forged)) by server05.metroland.com (8.13.1/8.13.1) with ESMTP id l162o74B036675; Mon, 5 Feb 2007 21:50:07 -0500 (EST) (envelope-from zcwalinski@metroland.com) Received: from CSYS-EVS01.corp.metroland.com ([10.151.25.36]) by server06.metroland.com (8.11.3/8.11.1) with ESMTP id l1632Mh38453; Mon, 5 Feb 2007 22:02:23 -0500 (EST) (envelope-from zcwalinski@metroland.com) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 5 Feb 2007 21:50:08 -0500 Message-ID: <5CD1A0226571E74A830A15192855981801964470@CSYS-EVS01.corp.metroland.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: I need help with Script running as a daemon !!! Thread-Index: AcdJlx7eNlGLj2WIT+6Ggbj18t3skQAAPzEg From: "Cwalinski, Zygmunt" To: "Brooks Davis" Cc: freebsd-rc@freebsd.org Subject: RE: I need help with Script running as a daemon !!! X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2007 02:50:16 -0000 -----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 !!! [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,=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) 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=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) "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=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 load_rc_config $name runtest_enable=3D${runtest_enable-:NO} runtest_start() { $command & echo $! > ${pidfile} } run_rc_command "$1" Zyggi