|
|
@@ -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
|