From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 25 20:37:48 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3DDA25B3; Tue, 25 Jun 2013 20:37:48 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from cpanel09.rubas.ch (cpanel09.rubas.ch [195.182.222.79]) by mx1.freebsd.org (Postfix) with ESMTP id F02F7156D; Tue, 25 Jun 2013 20:37:47 +0000 (UTC) Received: from 98-41.199-178.cust.bluewin.ch ([178.199.41.98]:60667 helo=gahrfit.gahr.ch) by cpanel09.rubas.ch with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1UrZzf-000xjQ-M8; Tue, 25 Jun 2013 22:37:40 +0200 Date: Tue, 25 Jun 2013 22:37:36 +0200 From: Pietro Cerutti To: Garrett Wollman Subject: Re: rc.d scripts to control multiple instances of the same daemon? Message-ID: <20130625203734.GD32654@gahrfit.gahr.ch> References: <20937.62239.626943.350086@hergotha.csail.mit.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d9ADC0YsG2v16Js0" Content-Disposition: inline In-Reply-To: <20937.62239.626943.350086@hergotha.csail.mit.edu> X-PGP-Key: 0x9571F78E X-PGP-Fingerprint: 1203 92B5 3919 AF84 9B97 28D6 C0C2 6A98 9571 F78E User-Agent: Mutt/1.5.21 (2010-09-15) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel09.rubas.ch X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - FreeBSD.org X-Get-Message-Sender-Via: cpanel09.rubas.ch: authenticated_id: gahr@gahr.ch Cc: ports@freebsd.org, hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: gahr@FreeBSD.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 20:37:48 -0000 --d9ADC0YsG2v16Js0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2013-Jun-25, 15:44, Garrett Wollman wrote: > I'm in the process of (re)writing an rc.d script for kadmind > (security/krb5). Unlike the main Kerberos daemon, kadmind needs to > have a separate instance for each realm on the server -- it can't > support multiple realms in a single process. What I need to be able > to do: >=20 > 1) Have different flags and pidfiles for each instance. > 2) Be able to start, stop, restart, and status each individual > instance by giving its name on the command line. > 3) Have all instances start/stop automatically when a specific > instance isn't specified. >=20 > I've looked around for examples of good practice to emulate, and > haven't found much. The closest to what I want looks to be > vboxheadless, but I'm uncomfortable with the amount of mechanism from > rc.subr that it needs to reimplement. Are there any better examples? Wouldn't something like this be enough? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #!/bin/sh =2E /etc/rc.subr name=3D"kadmind" rcvar=3D${name}_enable start_cmd=3D"kadmind_start $2" load_rc_config $name kadmind_start() { if [ -z $1 ]; then echo "starting all instances" else echo "starting instance $1" fi } run_rc_command "$1" =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # /usr/local/etc/rc.d/kadmind start starting all instances # /usr/local/etc/rc.d/kadmind start myinst starting instance myinst --=20 Pietro Cerutti The FreeBSD Project gahr@FreeBSD.org PGP Public Key: http://gahr.ch/pgp --d9ADC0YsG2v16Js0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iEYEARECAAYFAlHJ/44ACgkQwMJqmJVx944dUQCfXpZpkBM0hu+ycjlJJAy0tJLQ /VsAoNPUIY1yZl9dLBc0WOmPx3uyJZUW =djit -----END PGP SIGNATURE----- --d9ADC0YsG2v16Js0--