OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 11-Aug-2004 14:05:39 Branch: HEAD Handle: 2004081113053800 Modified files: openpkg-src/postgresql postgresql.spec rc.postgresql Log: provide start/stop support for slony1 Summary: Revision Changes Path 1.101 +11 -0 openpkg-src/postgresql/postgresql.spec 1.15 +36 -2 openpkg-src/postgresql/rc.postgresql ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/postgresql/postgresql.spec ============================================================================ $ cvs diff -u -r1.100 -r1.101 postgresql.spec --- openpkg-src/postgresql/postgresql.spec 11 Aug 2004 11:13:00 -0000 1.100 +++ openpkg-src/postgresql/postgresql.spec 11 Aug 2004 12:05:38 -0000 1.101 @@ -418,6 +418,17 @@ rm -f $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v73.sql mv $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v74.sql \ $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.sql + ( echo "# Slony-1 configuration for replication engine slon(1)" + echo "SLON_CLUSTER_NAME=\"example\"" + echo "SLON_CONNECT_DBNAME=\"example\"" + echo "SLON_CONNECT_USER=\"postgresql\"" + echo "SLON_CONNECT_PASS=\"postgresql\"" + echo "SLON_CONNECT_HOST=\"localhost\"" + echo "SLON_SYNC_INTERVAL=\"10000\"" + echo "SLON_SYNC_TIMEOUT=\"60000\"" + echo "SLON_SYNC_GROUPSIZE=\"6\"" + echo "SLON_SYNC_LOGLEVEL=\"1\"" + ) >$RPM_BUILD_ROOT%{l_prefix}/etc/postgresql/slony1.conf ) || exit $? %endif @@ . patch -p0 <<'@@ .' Index: openpkg-src/postgresql/rc.postgresql ============================================================================ $ cvs diff -u -r1.14 -r1.15 rc.postgresql --- openpkg-src/postgresql/rc.postgresql 11 Aug 2004 11:13:00 -0000 1.14 +++ openpkg-src/postgresql/rc.postgresql 11 Aug 2004 12:05:38 -0000 1.15 @@ -15,12 +15,32 @@ postgresql_log_numfiles="10" postgresql_log_minsize="1M" postgresql_log_complevel="9" + postgresql_slony1="no" postgresql_pgpool="no" %common postgresql_opts="-i -h $postgresql_socket_inet -k $postgresql_socket_unix" postgresql_opts="$postgresql_opts $postgresql_flags" postgresql_log_file="@l_prefix@/var/postgresql/run/postgresql.log" + postgresql_slony1_pidfile="@l_prefix@/var/postgresql/run/slon.pid" + postgresql_slony1_start () { + ( . @l_prefix@/etc/postgresql/slony1.conf + nohup @l_prefix@/bin/slon \ + -d "$SLON_SYNC_LOGLEVEL" -g "$SLON_SYNC_GROUPSIZE" \ + -s "$SLON_SYNC_INTERVAL" -t "$SLON_SYNC_TIMEOUT" \ + "$SLON_CLUSTER_NAME" \ + user="$SLON_CONNECT_USER" password="$SLON_CONNECT_PASS" \ + dbname="$SLON_CONNECT_DBNAME" host="$SLON_CONNECT_HOST" + </dev/null >/dev/null 2>&1 & + echo $! >$postgresql_slony1_pidfile + ) >/dev/null 2>&1 + } + postgresql_slony1_stop () { + if [ -f $postgresql_slony1_pidfile ]; then + kill -TERM `cat $postgresql_slony1_pidfile` + rm -f $postgresql_slony1_pidfile + fi + } %status -u @l_rusr@ -o postgresql_usable="unknown" @@ -35,18 +55,32 @@ rcService postgresql enable yes || exit 0 rcService postgresql active yes && exit 0 @l_prefix@/bin/pg_ctl start -l $postgresql_log_file -D $postgresql_datadir -o "$postgresql_opts" - rcVarIsYes postgresql_pgpool && @l_prefix@/bin/pgpool + if rcVarIsYes postgresql_slony1; then + postgresql_slony1_start + fi + if rcVarIsYes postgresql_pgpool; then + @l_prefix@/bin/pgpool + fi %stop -p 400 -u @l_rusr@ rcService postgresql enable yes || exit 0 rcService postgresql active no && exit 0 @l_prefix@/bin/pg_ctl stop -l $postgresql_log_file -D $postgresql_datadir -m $postgresql_shut_mode - rcVarIsYes postgresql_pgpool && @l_prefix@/bin/pgpool stop + if rcVarIsYes postgresql_slony1; then + postgresql_slony1_stop + fi + if rcVarIsYes postgresql_pgpool; then + @l_prefix@/bin/pgpool stop + fi %restart -p 400 -u @l_rusr@ rcService postgresql enable yes || exit 0 rcService postgresql active no && exit 0 @l_prefix@/bin/pg_ctl restart -l $postgresql_log_file -D $postgresql_datadir -o "$postgresql_opts" -m $postgresql_shut_mode + if rcVarIsYes postgresql_slony1; then + postgresql_slony1_stop + postgresql_slony1_start + fi if rcVarIsYes postgresql_pgpool; then @l_prefix@/bin/pgpool stop @l_prefix@/bin/pgpool @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]