Mark Stosberg mark at summersault.com
Mon Apr 7 11:03:37 PDT 2008
I wrote the following alternative to the provided FreeBSD rc.d script
for the following reasons:

- I didn't want to duplicate the set-up of profiles and options to slon
that altperl was already managing for me.
- I didn't want to install svscan for service monitoring when altperl
was already handling setup and teardown of watchdogs, and I didn't have
any other reason to run svscan.

With this solution I can still the Altperl tools I was already using to
manage slony, but I still get to have standard FreeBSD-style management
with "slon start", "slon stop" and enabling/disabling the service
through /etc/rc.conf.

The only thing I don't like about this is that I which slons to start
hardcoded in this script, which would vary from project project. I
suppose it would be possible to use Perl, load slon_tools.conf and
figure out an automatic default for these.

Comments ?

      Mark

#########

#!/bin/sh
#
# By Mark Stosberg for use with altperl

# PROVIDE: slon
# REQUIRE: postgresql
# KEYWORD: shutdown

. "/etc/rc.subr"

name="slon"
rcvar=`set_rcvar`

load_rc_config "$name"

# From global rc.conf(5); if unset, set them here
[ -z "$slon_enable" ]       && slon_enable="NO"

case $1 in
start)
# NOTE: These lines are customized for the number and quantity of nodes
in a given cluster
          /usr/local/sbin/slon_start 3
          /usr/local/sbin/slon_start 2
          /usr/local/sbin/slon_start 1
          echo -n 'slon started'
      ;;

stop)
          /usr/local/sbin/slon_kill
      ;;

*)
      echo "usage: `basename $0` {start|stop}" >&2
      exit 64
      ;;
esac



-- 
  . . . . . . . . . . . . . . . . . . . . . . . . . . .
    Mark Stosberg            Principal Developer
    mark at summersault.com     Summersault, LLC
    765-939-9301 ext 202     database driven websites
  . . . . . http://www.summersault.com/ . . . . . . . .


More information about the Slony1-general mailing list