From owner-freebsd-questions@FreeBSD.ORG Mon Nov 21 15:24:09 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E964016A470 for ; Mon, 21 Nov 2005 15:24:08 +0000 (GMT) (envelope-from freebsd@orchid.homeunix.org) Received: from orchid.homeunix.org (aun120.neoplus.adsl.tpnet.pl [83.27.21.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id 02B4443D45 for ; Mon, 21 Nov 2005 15:24:07 +0000 (GMT) (envelope-from freebsd@orchid.homeunix.org) Received: from [192.168.1.66] (blackacidevil.orchid.homeunix.org [192.168.1.66]) (authenticated bits=0) by orchid.homeunix.org (8.13.4/8.13.4) with ESMTP id jALFNwe5004132 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Mon, 21 Nov 2005 16:24:05 +0100 (CET) (envelope-from freebsd@orchid.homeunix.org) Message-ID: <4381E687.7020707@orchid.homeunix.org> Date: Mon, 21 Nov 2005 16:23:51 +0100 From: Karol Kwiatkowski User-Agent: Thunderbird 1.5 (X11/20051114) MIME-Version: 1.0 To: Michael Beattie References: <011e01c5ee41$a8a18610$c801a8c0@nexpc> <20051121140830.M11345@pobox.sk> <20051121142219.GA41185@thoron.org> In-Reply-To: X-Enigmail-Version: 0.93.0.0 OpenPGP: id=06E09309; url=http://www.orchid.homeunix.org/carlos/gpg/0x06E09309.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig5560FAEFD57FCE3706F8BEED" X-Virus-Scanned: ClamAV 0.87.1/1181/Mon Nov 21 12:10:32 2005 on orchid.homeunix.org X-Virus-Status: Clean Cc: martinko , freebsd-questions@freebsd.org, "Halldor R. Haflidason" Subject: Re: starting services? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@orchid.homeunix.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2005 15:24:09 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5560FAEFD57FCE3706F8BEED Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Michael Beattie wrote: > On 11/21/05, Halldor R. Haflidason wrote: >> On Monday, 21 November 2005 at 15:11:35 +0100, martinko wrote: >>> On Mon, 21 Nov 2005 10:17:01 +0800, Foo Ji-Haw wrote >>>>> i wonder why i cannot start for instance ssh with >>>>> /etc/rc.d/sshd start >>>>> but i always have to use >>>>> /etc/rc.d/sshd forcestart >>>>> and similarly for stop, status, etc. >>>>> >>>>> any ideas pls ?? >>>> You have to add a line in /etc/rc.conf. I think it is >>>> samba_enable=3D"YES". >>> >>> well, if you add sshd_enable=3D"YES", the service (always) starts on = boot. >>> >>> i just want to start it manually and i wonder why it doesn't listen t= o "start" >>> argument but only "forcestart" and similarly for other commands i've = got to >>> use "force". >>> >>> anyone knows why pls ?? >>> >>> martin >> Because when the system boots up it sends the 'start' argument to all = the >> scripts in the rc.d directories, those scripts then check wether they >> should start or not. Force start simply overrides that check. >> >> Halldor >=20 > Then something's broken, no? If the service isnt running and you send > it a "start" and it doesnt start, then that's bad. You shouldnt need > to override some checks, it should do what it's commanded to do. If you're talking about implementation no, it's not. In order to start a service with "start" argument it needs to be "enabled" in /etc/rc.conf. It's nicely documented in various places like man 8 rc or /etc/rc.subr. What OP is looking for is 'onestart' and 'onestop' parameters. I was looking for a solution to the same issue some days ago and found that in /etc/rc.subr: # If argument has a given prefix, then change the operation as follows: # Prefix Operation # ------ --------- # fast Skip the pid check, and set rc_fast=3Dyes # force Set ${rcvar} to YES, and set rc_force=3Dyes # one Set ${rcvar} to YES Basically "/etc/rc.d/sshd onestart" will let you run sshd service without enabling it in rc.conf (which also means it'll start at boot time) yet it checks if sshd is not running already. Hope that helps, Karol --=20 Karol Kwiatkowski --------------enig5560FAEFD57FCE3706F8BEED Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDgeaPezeoPAwGIYsRAnK5AJ4kvy9LBYZcAgWS3kImlIh/Kqk6LwCfdgc2 dRMsWwE5UcXtpLmuF0I9sjU= =NO3e -----END PGP SIGNATURE----- --------------enig5560FAEFD57FCE3706F8BEED--