Thu May 7 10:48:17 PDT 2009
- Previous message: [Slony1-general] simple configuration files on Debian/Ubuntu
- Next message: [Slony1-general] simple configuration files on Debian/Ubuntu
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
--- On Thu, 7/5/09, Bruce Rindahl <rindahl at lrcwe.com> wrote: > When I do this (and redirect to /dev/null and in > background) slony runs fine. How do I put this information > into a configuration file so the slony daemon reads this > automatically on startup? Hi Bruce, You need to create an init script in /etc/init.d and then use update-rc.d to set the runlevels and order to run Mine is pasted below, you'll need to edit it as appropriate. Note the use of slon.conf rather than passing the adminconinfo at the command line: #!/bin/sh # Name script NAME=slony # Source function library. . /lib/lsb/init-functions # Get function listing for cross-distribution logic. TYPESET=`typeset -f|grep "declare"` # Installation prefix prefix=/usr/local/pgsql # Data directory PGDATA=/pgsql/postgres SLONDATA=/pgsql/slony LOGDATA=/pgsql/logs # Slony user PGUSER=slony # Set defaults for configuration variables SLONENGINE=$prefix/bin SLONDAEMON=$SLONENGINE/slon SLONCONF=$SLONDATA/slon.conf SLONLOG=$LOGDATA/slon.log # Grab the pid file from the conf file SLONPIDLINE=`grep pid_file $SLONCONF | cut -d "#" -f 1 | grep "^[:space:]*pid_file='.*'"` SLONPID=`echo $SLONPIDLINE | cut -d "=" -f 2 | cut -d "'" -f 2` # Now, we know where the pid file is, if we find it we grab the # pid out of the file then we see if it's in the process list. # This should ensuire slon restarts in the case of a crash. if [ "x$SLONPID" == "x" ]; then echo "pid_file not found in slon conf file - $SLONCONF" exit 1 else if [ -f $SLONPID ]; then PID=`cat $SLONPID` FINDPID=`ps -p ${PID} | awk '{print $1}' | grep "^$PID\$"` fi fi test -x $SLONDAEMON || exit 5 script_result=0 start(){ echo -n $"Starting ${NAME} service: " if [ ! -z "$FINDPID" ] then echo "PID file ${SLONPID} indicates slon already running PID $PID : Not starting " else su - $PGUSER -c "$SLONDAEMON -f $SLONCONF > "$SLONLOG" 2>&1 &" < /dev/null sleep 5 fi if [ -f $SLONPID ]; then PID=`cat $SLONPID` FINDPID=`ps -p ${PID} | awk '{print $1}' | grep "^$PID\$"` fi if [ ! -z "$FINDPID" ] then echo "OK" else echo "Failed" fi RETVAL=$? echo return $RETVAL } stop(){ echo -n $"Stopping ${NAME} service: " if [ ! -z "$FINDPID" ] then killall -s SIGTERM slon sleep 5 PID=`` FINDPID=`` else echo "Slon with PID ${PID} not found" fi if [ -f $SLONPID ]; then PID=`cat $SLONPID` FINDPID=`ps -p ${PID} | awk '{print $1}' | grep "^$PID\$"` fi if [ ! -z "$FINDPID" ] then echo "Failed" else echo "OK" fi RETVAL=$? echo return $RETVAL } restart(){ stop echo "Waiting for 10 seconds" sleep 10 start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $script_result
- Previous message: [Slony1-general] simple configuration files on Debian/Ubuntu
- Next message: [Slony1-general] simple configuration files on Debian/Ubuntu
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list