ports/80113: Slony-I rc.d script

Fernando Schapachnik fernando at mecon.gov.ar
Tue Apr 19 17:40:21 UTC 2005


>Number:         80113
>Category:       ports
>Synopsis:       Slony-I rc.d script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 19 17:40:20 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Fernando Schapachnik
>Release:        FreeBSD 5.3-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD bal740r0.mecon.gov.ar 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #3: Tue Jan 18 12:25:08 ART 2005 root at bal740r0.mecon.gov.ar:/usr/obj/usr/src/sys/BAL740R0 i386


	
>Description:
	The Slony-I lacks a startup/shutdown (rc.d) script.
	
>How-To-Repeat:
	
>Fix:

	Here is one. It supports master/slave (but on at the same time).

#!/bin/sh

# PROVIDE: slony
# REQUIRE: NETWORKING postgresql
# BEFORE:  
# KEYWORD: FreeBSD shutdown

. /etc/rc.subr

name="slony"
rcvar=`set_rcvar`
command="/usr/local/bin/slon"
log=/var/log/slon.log

load_rc_config $name

# Set defaults.
slony_enable=${slony_enable:-"NO"}
slony_master=${slony_master:-"NO"}
slony_slave=${slony_slave:-"NO"}

variable_check()
{
 eval val=\$${1}
 # Check for required parameters.
 if [ -z ${val-""} ]
 then
	err 1 Variable $1 not defined.
 fi
}

variable_check slony_cluster
variable_check slony_replicationuser

if checkyesno slony_master && checkyesno slony_slave
then
	err 1 "This startup script doesn't allow to start both a master and slave."
fi

# Run master?
if checkyesno slony_master
then
	variable_check slony_masterdb
	variable_check slony_masterhost
	slony_host=$slony_masterhost
	slony_db=$slony_masterdb
fi

# Run slave?
if checkyesno slony_slave
then
	variable_check slony_slavedb
	variable_check slony_slavehost
	slony_host=$slony_slavehost
	slony_db=$slony_slavedb
fi

command_args="${slony_cluster} \"dbname=${slony_db} user=${slony_replicationuser} host=${slony_host}\" >> $log 2>&1 &"

run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list