From c54e63b896187fa7d4b08eba7ec3844f8983b475 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 9 Oct 2007 08:56:41 +0000 Subject: [PATCH] Disable init.d script, add as example. Pgbouncer does not have enough infra yet to run as boot-up daemon (chroot, setuid, etc) Postponed after 1.1. --- Makefile | 2 +- debian/packages | 45 ------------------------------ etc/example.debian.init.sh | 56 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 etc/example.debian.init.sh diff --git a/Makefile b/Makefile index 99573bc..dd808b3 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ DATA = README NEWS AUTHORS etc/pgbouncer.ini Makefile config.mak.in config.h.in configure configure.ac debian/packages debian/changelog doc/Makefile \ test/Makefile test/asynctest.c test/conntest.sh test/ctest6000.ini \ test/ctest7000.ini test/run-conntest.sh test/stress.py test/test.ini \ - test/test.sh test/userlist.txt + test/test.sh test/userlist.txt etc/example.debian.init.sh DIRS = doc etc src debian test # keep autoconf stuff separate diff --git a/debian/packages b/debian/packages index efc9d8c..c0525ad 100644 --- a/debian/packages +++ b/debian/packages @@ -24,48 +24,3 @@ Description: Lightweight connection pooler for PostgreSQL . Install: sh make install DESTDIR=$ROOT -Init: sh - NAME=pgbouncer - DAEMON=/usr/bin/$NAME - PIDFILE=/var/run/$NAME.pid - CONF=/etc/$NAME.ini - OPTS="-d $CONF" - # note: SSD is required only at startup of the daemon. - SSD=`which start-stop-daemon` - ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin" - - trap "" 1 - - # Check if configuration exists - test -f $CONF || exit 0 - - case "$1" in - start) - echo -n "Starting server: $NAME" - $ENV $SSD --start --pidfile $PIDFILE --exec $DAEMON -- $OPTS > /dev/null - ;; - stop) - echo -n "Stopping server: $NAME" - start-stop-daemon --stop --pidfile $PIDFILE - ;; - reload | force-reload) - echo -n "Reloading $NAME configuration" - start-stop-daemon --stop --pidfile $PIDFILE --signal HUP - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart}" - exit 1 - ;; - esac - if [ $? -eq 0 ]; then - echo . - exit 0 - else - echo " failed" - exit 1 - fi - diff --git a/etc/example.debian.init.sh b/etc/example.debian.init.sh new file mode 100644 index 0000000..2fa0e20 --- /dev/null +++ b/etc/example.debian.init.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# pgbouncer Start the PgBouncer PostgreSQL pooler. +# +# The variables below are NOT to be changed. They are there to make the +# script more readable. + +NAME=pgbouncer +DAEMON=/usr/bin/$NAME +PIDFILE=/var/run/$NAME.pid +CONF=/etc/$NAME.ini +OPTS="-d $CONF" +# note: SSD is required only at startup of the daemon. +SSD=`which start-stop-daemon` +ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin" + +trap "" 1 + +# Check if configuration exists +test -f $CONF || exit 0 + +case "$1" in + start) + echo -n "Starting server: $NAME" + $ENV $SSD --start --pidfile $PIDFILE --exec $DAEMON -- $OPTS > /dev/null + ;; + + stop) + echo -n "Stopping server: $NAME" + start-stop-daemon --stop --pidfile $PIDFILE + ;; + + reload | force-reload) + echo -n "Reloading $NAME configuration" + start-stop-daemon --stop --pidfile $PIDFILE --signal HUP + ;; + + restart) + $0 stop + $0 start + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart}" + exit 1 + ;; +esac + +if [ $? -eq 0 ]; then + echo . + exit 0 +else + echo " failed" + exit 1 +fi + -- 2.40.0