From: Marko Kreen Date: Tue, 9 Oct 2007 08:37:12 +0000 (+0000) Subject: Add init.d script to debian package. X-Git-Tag: pgbouncer_1_1~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec593d9794b1fef6f37e647564ecc751e5b38eb6;p=pgbouncer Add init.d script to debian package. By Dimitri Fontaine --- diff --git a/debian/packages b/debian/packages index c0525ad..efc9d8c 100644 --- a/debian/packages +++ b/debian/packages @@ -24,3 +24,48 @@ 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 +