Re: rc.d scripts to control multiple instances of the same daemon?

2013-06-26 Thread Alex Dupre
Garrett Wollman ha scritto:
 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?

Basically there are two types of implementation with different pro/cons:
profiles and symlinks.

vboxheadless is in the first category, tomcat7 in the second one:

http://svnweb.freebsd.org/ports/head/www/tomcat7/files/tomcat7.in?revision=307489view=markup

-- 
Alex Dupre
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: rc.d scripts to control multiple instances of the same daemon?

2013-06-25 Thread Ian Lepore
On Tue, 2013-06-25 at 15:44 -0400, 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?

The one like that I use the most is service netif restart fpx0 but I'm
not sure the complex network stuff will be the cleanest example of
anything except how to do complex network stuff. :)

-- Ian


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: rc.d scripts to control multiple instances of the same daemon?

2013-06-25 Thread olli hauer
On 2013-06-25 21: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?
 
 -GAWollman
 

Take a look into the openvpn rc script (works with softlinks). A more
complex script that supports multiple instances can be found in the
www/apache2x ports.

--
olli
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: rc.d scripts to control multiple instances of the same daemon?

2013-06-25 Thread Pietro Cerutti
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
g...@freebsd.org

PGP Public Key:
http://gahr.ch/pgp


pgptufEfB2ZjQ.pgp
Description: PGP signature


Re: rc.d scripts to control multiple instances of the same daemon?

2013-06-25 Thread Baptiste Daroussin
On Tue, Jun 25, 2013 at 03:44:31PM -0400, 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?
 
 -GAWollman
 
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org

This is a simple multi instance rc.d script:
http://svnweb.freebsd.org/ports/head/www/fcgiwrap/files/fcgiwrap.in?revision=307542view=markup

regards,
Bapt


pgptAOgDKVF01.pgp
Description: PGP signature