Thu May 17 00:13:57 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/redhat slon.init
- Next message: [Slony1-commit] slony1-engine postgresql-slony1-engine.spec.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/redhat
In directory main.slony.info:/tmp/cvs-serv24376
Added Files:
Tag: REL_1_2_STABLE
slon.init
Log Message:
Init script for Red Hat / Fedora. This script will need testing, but AFAICS it works fine.
TODO: We must incorporate this init script to RPM.
--- NEW FILE: slon.init ---
#!/bin/sh
# postgresql This is the init script for starting up the Slony-I
#
# chkconfig: - 64 36
# description: Starts and stops the Slon daemon that handles
# Slony-I replication.
# processname: slon
# pidfile: /var/run/slon.pid
#
# v1.0.0 Devrim GUNDUZ <devrim at CommandPrompt.com>
# - Initial version of Red Hat / Fedora init script, based on Ubuntu one.
if [ -r /etc/sysconfig/slony1 ]; then
. /etc/sysconfig/slony1
fi
# Source function library.
INITD=/etc/rc.d/init.d
. $INITD/functions
# Get function listing for cross-distribution logic.
TYPESET=`typeset -f|grep "declare"`
# Get config.
. /etc/sysconfig/network
# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
SU=runuser
else
SU=su
fi
# Check that networking is up.
# We need it for slon
[ "${NETWORKING}" = "no" ] && exit 0
# Find the name of the script
NAME=`basename $0`
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
then
NAME=${NAME:3}
fi
# Set defaults for configuration variables
SLONENGINE=/usr/bin
SLONDAEMON=$SLONENGINE/slon
SLONCONF=/etc/slon.conf
SLONPID=/var/run/slon.pid
test -x $SLONDAEMON || exit 5
script_result=0
start(){
SLON_START=$"Starting ${NAME} service: "
echo -n "$SLON_START"
daemon $SLONDAEMON -f $SLONCONF -p $SLONPID 2>&1 </dev/null &
sleep 2
pid=`pidof -s "$SLONDAEMON"`
if [ $pid ]
then
success "$SLON_START"
touch /var/lock/subsys/${NAME}
echo
else
failure "$PSQL_START"
echo
script_result=1
fi
}
stop(){
echo -n $"Stopping ${NAME} service: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc /usr/bin/slon
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${NAME}
fi;
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/${NAME} ] && restart
}
condstop(){
[ -e /var/lock/subsys/${NAME} ] && stop
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status postmaster
script_result=$?
;;
restart)
restart
;;
condrestart)
condrestart
;;
condstop)
condstop
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|condstop}"
exit 1
esac
exit $script_result
- Previous message: [Slony1-commit] slony1-engine/redhat slon.init
- Next message: [Slony1-commit] slony1-engine postgresql-slony1-engine.spec.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list