Commit 116a7d3b authored by Christoph Berg's avatar Christoph Berg

* Use start-stop-daemon for stopping the daemon. Closes: #641568.

* Use pgbouncer -R to restart in place, thanks Cody Cutrer for the patch.
  Closes: #657204.
parent a0c2fe06
pgbouncer (1.5-1) UNRELEASED; urgency=low
pgbouncer (1.5-1) unstable; urgency=low
[ Peter Eisentraut ]
* Update watch file to allow .tar.gz in addition to .tgz
......@@ -6,9 +6,12 @@ pgbouncer (1.5-1) UNRELEASED; urgency=low
[ Christoph Berg ]
* New upstream release.
* Use start-stop-daemon for stopping the daemon. Closes: #641568.
* Use pgbouncer -R to restart in place, thanks Cody Cutrer for the patch.
Closes: #657204.
* Update URL in README.Debian. Closes: #655283.
-- Peter Eisentraut <petere@debian.org> Sat, 21 Jan 2012 01:13:16 +0200
-- Christoph Berg <myon@debian.org> Fri, 27 Jan 2012 17:40:22 +0100
pgbouncer (1.4.2-2) unstable; urgency=low
......
#!/bin/bash
#!/bin/sh
### BEGIN INIT INFO
# Provides: pgbouncer
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Should-Start: postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
......@@ -12,103 +12,74 @@
# proxy for PostgreSQL.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/pgbouncer
PIDFILE=/var/run/postgresql/pgbouncer.pid
OPTS="-d /etc/pgbouncer/pgbouncer.ini"
test -x $DAEMON || exit 5
NAME=pgbouncer
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/postgresql/$NAME.pid
OPTS="-d /etc/pgbouncer/$NAME.ini"
RUNASUSER="postgres"
# Include pgbouncer defaults if available
if [ -f /etc/default/pgbouncer ] ; then
. /etc/default/pgbouncer
fi
# Exit if we were uninstalled with the config still there
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
is_running() {
pidofproc -p $PIDFILE $DAEMON >/dev/null
}
d_start() {
if [ ${START} -eq 1 ]; then
if is_running; then
:
else
su -c "$DAEMON $OPTS 2> /dev/null &" - postgres
fi
else
log_warning_msg "pgbouncer daemon disabled in /etc/default/pgbouncer"
fi
}
d_reload() {
is_running || return 0
killproc -p $PIDFILE $DAEMON HUP
}
d_stop() {
SIGS='INT TERM KILL'
for sig in $SIGS
do
is_running || return 0
killproc -p $PIDFILE $DAEMON $sig
sleep 1
done
}
# Check if configuration exists
test -f $CONF || exit 0
case "$1" in
start)
log_daemon_msg Starting pgbouncer
d_start
log_end_msg $?
;;
stop)
log_daemon_msg Stopping pgbouncer
d_stop
log_end_msg $?
;;
status)
is_running
status=$?
if [ $status -eq 0 ]; then
log_success_msg "pgbouncer is running"
else
log_failure_msg "pgbouncer is not running"
fi
exit $status
;;
restart)
log_daemon_msg "Restarting pgbouncer" pgbouncer
d_stop
d_start
log_end_msg $?
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload|force-reload)
if is_running; then
log_daemon_msg "Reloading configuration" pgbouncer
d_reload
log_end_msg $?
else
log_failure_msg "pgbouncer is not running."
fi
;;
*)
log_failure_msg "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
exit 2
;;
start)
echo -n "Starting server: $NAME"
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --chuid $RUNASUSER -- $OPTS 2> /dev/null
;;
stop)
echo -n "Stopping server: $NAME"
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --retry 30
;;
reload | force-reload)
echo -n "Reloading $NAME configuration"
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --signal HUP
;;
restart)
start-stop-daemon --status --pidfile $PIDFILE --exec $DAEMON
if [ $? -eq 0 ] ; then
echo -n "Invoking $NAME restart"
su -c "$DAEMON -R $OPTS 2> /dev/null" - $RUNASUSER
sleep 5
start-stop-daemon --status --pidfile $PIDFILE --exec $DAEMON
else
$0 start
fi
;;
status)
start-stop-daemon --status --pidfile $PIDFILE --exec $DAEMON
status=$?
if [ $status -eq 0 ]; then
log_success_msg "pgbouncer is running"
else
log_failure_msg "pgbouncer is not running"
fi
exit $status
;;
*)
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
......@@ -3,13 +3,12 @@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
#DH_VERBOSE = 1
DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin
DEB_UPDATE_RCD_PARAMS := defaults 20 18
DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin
DEB_DH_INSTALLINIT_ARGS := -R
clean::
find doc -name "pgbouncer.*" -exec rm {} \;
rm -f doc/*.xml
install/pgbouncer::
rm -f $(CURDIR)/debian/pgbouncer/usr/share/doc/pgbouncer/pgbouncer.ini
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment