postgresql/rc.postgresql

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.postgresql -- Run-Commands
     4 ##
     6 %config
     7     postgresql_enable="$openpkg_rc_def"
     8     postgresql_flags=""
     9     postgresql_datadir="@l_prefix@/var/postgresql/db"
    10     postgresql_rundir="@l_prefix@/var/postgresql/run"
    11     postgresql_shut_mode="fast"
    12     postgresql_socket_inet="127.0.0.1"
    13     postgresql_socket_unix="@l_prefix@/var/postgresql/run"
    14     postgresql_log_prolog="true"
    15     postgresql_log_epilog="true"
    16     postgresql_log_numfiles="10"
    17     postgresql_log_minsize="1M"
    18     postgresql_log_complevel="9"
    19     postgresql_slony1="no"
    21 %common
    22     postgresql_opts="-h $postgresql_socket_inet -k $postgresql_socket_unix"
    23     postgresql_opts="$postgresql_opts $postgresql_flags"
    24     postgresql_logfile="$postgresql_rundir/postgresql.log"
    25     postgresql_pidfile="$postgresql_datadir/postgresql.pid"
    26     postgresql_slony1_pidfile="$postgresql_rundir/slon.pid"
    27     postgresql_slony1_start () {
    28         ( . @l_prefix@/etc/postgresql/slony1.conf
    29           nohup @l_prefix@/bin/slon \
    30               -d "$SLON_SYNC_LOGLEVEL" -g "$SLON_SYNC_GROUPSIZE" \
    31               -s "$SLON_SYNC_INTERVAL" -t "$SLON_SYNC_TIMEOUT" \
    32               "$SLON_CLUSTER_NAME" \
    33               user="$SLON_CONNECT_USER" password="$SLON_CONNECT_PASS" \
    34               dbname="$SLON_CONNECT_DBNAME" host="$SLON_CONNECT_HOST"
    35               </dev/null >/dev/null 2>&1 &
    36           echo $! >$postgresql_slony1_pidfile
    37         ) >/dev/null 2>&1
    38     }
    39     postgresql_slony1_stop () {
    40         if [ -f $postgresql_slony1_pidfile ]; then
    41             kill -TERM `cat $postgresql_slony1_pidfile`
    42             rm -f $postgresql_slony1_pidfile
    43         fi
    44     }
    45     postgresql_ctl () {
    46         if [ -s $postgresql_pidfile ]; then
    47             kill -0 `head -1 $postgresql_pidfile` >/dev/null 2>&1
    48             if [ $? -ne 0 ]; then
    49                 rm -f $postgresql_pidfile    >/dev/null 2>&1 || true
    50                 rm -f $postgresql_rundir/.s* >/dev/null 2>&1 || true
    51             fi
    52         fi
    53         cmd="$1"; shift
    54         @l_prefix@/bin/pg_ctl $cmd \
    55             -l $postgresql_logfile \
    56             -D $postgresql_datadir \
    57             ${1+"$@"}
    58     }
    60 %status -u @l_rusr@ -o
    61     postgresql_usable="unknown"
    62     postgresql_active="no"
    63     rcService postgresql enable yes && \
    64         postgresql_ctl status >/dev/null && \
    65         postgresql_active="yes"
    66     echo "postgresql_enable=\"$postgresql_enable\""
    67     echo "postgresql_usable=\"$postgresql_usable\""
    68     echo "postgresql_active=\"$postgresql_active\""
    70 %start -p 400 -u @l_rusr@
    71     rcService postgresql enable yes || exit 0
    72     rcService postgresql active yes && exit 0
    73     postgresql_ctl start -o "$postgresql_opts"
    74     if rcVarIsYes postgresql_slony1; then
    75         postgresql_slony1_start
    76     fi
    78 %stop -p 600 -u @l_rusr@
    79     rcService postgresql enable yes || exit 0
    80     rcService postgresql active no  && exit 0
    81     postgresql_ctl stop -m "$postgresql_shut_mode"
    82     if rcVarIsYes postgresql_slony1; then
    83         postgresql_slony1_stop
    84     fi
    86 %restart -p 400 -u @l_rusr@
    87     rcService postgresql enable yes || exit 0
    88     rcService postgresql active no  && exit 0
    89     postgresql_ctl restart -o "$postgresql_opts" -m "$postgresql_shut_mode"
    90     if rcVarIsYes postgresql_slony1; then
    91         postgresql_slony1_stop
    92         postgresql_slony1_start
    93     fi
    95 %reload -p 400 -u @l_rusr@
    96     rcService postgresql enable yes || exit 0
    97     rcService postgresql active no  && exit 0
    98     postgresql_ctl reload
   100 %daily -u @l_rusr@
   101     rcService postgresql enable yes || exit 0
   102     shtool rotate -f \
   103         -n ${postgresql_log_numfiles} -s ${postgresql_log_minsize} -d -c \
   104         -z ${postgresql_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \
   105         -P "$postgresql_log_prolog" \
   106         -E "$postgresql_log_epilog" \
   107         $postgresql_logfile

mercurial