Package: postgresql-common
Version: 159
Severity: wishlist
Tags: patch

Dear Maintainer,

I just saw an update that gave me some systemd services. As I had trouble converting the init scripts to Upstart jobs in the past, I was interested and took a look. The new option in pg_ctlcluster, --stdlog, has allowed me to complete my Upstart jobs, which are attached. I would greatly appreciate if you included them in the next upload of your package.

Best wishes,
--
Cameron Norman

-- System Information:
Debian Release: jessie/sid
 APT prefers unstable
 APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages postgresql-common depends on:
ii adduser 3.113+nmu3
ii debconf [debconf-2.0] 1.5.53
ii lsb-base 4.1+Debian13
ii postgresql-client-common 159
ii procps 1:3.3.9-7
ii ssl-cert 1.0.34
ii ucf 3.0030

Versions of packages postgresql-common recommends:
ii logrotate 3.8.7-1

postgresql-common suggests no packages.

-- Configuration Files:
/etc/postgresql-common/createcluster.conf changed [not included]

-- debconf information excluded
description "PostgreSQL - RDBMS server (cluster)"
author "Cameron Norman <camerontnor...@gmail.com>"

usage "VERSION - version of postgres, \
       CLUSTER - cluster within the version."
instance $VERSION-$CLUSTER

export VERSION
export CLUSTER

stop on (stop-postgresql-clusters VERSION=$VERSION
         or deconfiguring-networking
         or unmounting-filesystem
         or runlevel [016])

pre-start exec rm -f /var/run/postgresql/$VERSION-$CLUSTER.pid

normal exit 0 TERM INT
respawn
exec /usr/bin/pg_ctlcluster --foreground --stdlog $VERSION $CLUSTER start

post-start script
        for t in $(seq 1 60); do
                sleep 0.25
                test -e /var/run/postgresql/$VERSION-$CLUSTER.pid && exit 0
        done
        # None of the status calls succeeded
        echo "Postgres cluster failed to start."
        stop; exit 1
end script

kill timeout 15
pre-stop exec /usr/bin/pg_ctlcluster -m fast $VERSION $CLUSTER stop
description "PostgreSQL - RDBMS server"

start on runlevel [2345]
stop on runlevel [!2345]

pre-start script
    [ -r /usr/share/postgresql-common/init.d-functions ] || exit 0
    . /usr/share/postgresql-common/init.d-functions

    get_versions

    # create socket directory
    if [ -d /var/run/postgresql ]; then
        chmod 2775 /var/run/postgresql
    else
        install -d -m 2775 -o postgres -g postgres /var/run/postgresql
        [ -x /sbin/restorecon ] && restorecon -R /var/run/postgresql || true
    fi

    # Start version instances
    ret=0
    for v in $versions; do
        initctl start postgresql-version VERSION=$v || ret=$?
    done
    exit $ret
end script

post-stop exec initctl emit stop-postgresql-versions
description "PostgreSQL - RDBMS server (version)"
author "Cameron Norman <camerontnor...@gmail.com>"

stop on (stop-postgresql-versions
         or deconfiguring-networking
         or unmounting-filesystem
         or runlevel [016])

instance $VERSION
usage "VERSION - version of PostgreSQL with corresponding config and binary"
export VERSION

pre-start script
    [ -d "/etc/postgresql/$VERSION" ] || exit 0
    [ "$(ls /etc/postgresql/$VERSION)" ] || exit 0
    [ -x "/usr/lib/postgresql/$VERSION/bin/postmaster" ] || exit 0

    ret=0
    for c in /etc/postgresql/"$VERSION"/*; do
        [ -e "$c/postgresql.conf" ] || continue
        name=$(basename "$c")

        # evaluate start.conf
        if [ -e "$c/start.conf" ]; then
            start=$(sed 's/#.*$//; /^[[:space:]]*$/d; s/^\s*//; s/\s*$//' 
"$c/start.conf")
        else
            start=auto
        fi
        [ "$start" = "auto" ] || continue

        initctl start postgresql-cluster VERSION=$VERSION CLUSTER=$name || 
ret=$?
    done
    exit $ret
end script

post-stop exec initctl emit stop-postgresql-clusters VERSION=$VERSION

Reply via email to