Date: Tue, 25 Jun 2013 22:37:36 +0200 From: Pietro Cerutti <gahr@FreeBSD.org> To: Garrett Wollman <wollman@freebsd.org> Cc: ports@freebsd.org, hackers@freebsd.org Subject: Re: rc.d scripts to control multiple instances of the same daemon? Message-ID: <20130625203734.GD32654@gahrfit.gahr.ch> In-Reply-To: <20937.62239.626943.350086@hergotha.csail.mit.edu> References: <20937.62239.626943.350086@hergotha.csail.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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:
>
> 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.
>
> 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?
====================================================================
#!/bin/sh
. /etc/rc.subr
name="kadmind"
rcvar=${name}_enable
start_cmd="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"
====================================================================
# /usr/local/etc/rc.d/kadmind start
starting all instances
# /usr/local/etc/rc.d/kadmind start myinst
starting instance myinst
--
Pietro Cerutti
The FreeBSD Project
gahr@FreeBSD.org
PGP Public Key:
http://gahr.ch/pgp
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (FreeBSD)
iEYEARECAAYFAlHJ/44ACgkQwMJqmJVx944dUQCfXpZpkBM0hu+ycjlJJAy0tJLQ
/VsAoNPUIY1yZl9dLBc0WOmPx3uyJZUW
=djit
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130625203734.GD32654>
