From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 8 08:57:11 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E78331065672 for ; Fri, 8 Aug 2008 08:57:11 +0000 (UTC) (envelope-from vince@unsane.co.uk) Received: from unsane.co.uk (unsane-pt.tunnel.tserv5.lon1.ipv6.he.net [IPv6:2001:470:1f08:110::2]) by mx1.freebsd.org (Postfix) with ESMTP id 643AE8FC1B for ; Fri, 8 Aug 2008 08:57:11 +0000 (UTC) (envelope-from vince@unsane.co.uk) Received: from vhoffman-macbook.lon.namesco.net (150.117-84-212.staticip.namesco.net [212.84.117.150]) (authenticated bits=0) by unsane.co.uk (8.14.0/8.14.0) with ESMTP id m788vJAs074085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Aug 2008 09:57:21 +0100 (BST) (envelope-from vince@unsane.co.uk) Message-ID: <489C0A63.8040600@unsane.co.uk> Date: Fri, 08 Aug 2008 09:57:07 +0100 From: Vincent Hoffman User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: Alex Kozlov References: <20080808033317.GA96397@ravenloft.kiev.ua> In-Reply-To: <20080808033317.GA96397@ravenloft.kiev.ua> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org, Mike Meyer Subject: Re: Idea for FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2008 08:57:12 -0000 Alex Kozlov wrote: > On Thu, Aug 07, 2008 at 11:25:39AM -0400, Mike Meyer wrote: > >> On Thu, 7 Aug 2008 09:15:00 +0300 Alex Kozlov wrote: >> >>> [1]: >>> $cat /usr/local/bin/service >>> >> Basically what I had in mind, but it can be made more portable across >> FreeBSD configurations. >> >> > [...] > >> And here's where you go wrong. What you want now is: >> > Yes. This is more correct: > > Just to save reimplementing the wheel, have a look also at the sysutils/bsdadminscripts port. it has rcstart (and various hardlinks,) which are intended for pretty much what youre intending I think. Vince > #!/bin/sh > > name=$1 > cmd=$2 > > if [ -z "${name}" -o -z "${cmd}" ]; then > echo ${0##*/} service_name command > exit 3 > fi > > . /etc/rc.subr > > load_rc_config ${name} > > for dir in /etc/rc.d ${local_startup}; do > if [ -r "${dir}/${name}" ]; then > run_rc_script "${dir}/${name}" ${cmd} > exit 0 > fi > > if [ -r "${dir}/${name}.sh" ]; then > run_rc_script "${dir}/${name}.sh" ${cmd} > exit 0 > fi > done > > echo "service '${name}' not found" > exit 2 > > > -- > Adios > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >