This file is indexed.

/etc/init.d/pgbouncer is in pgbouncer 1.8.1-1build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh

### BEGIN INIT INFO
# Provides:          pgbouncer
# 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
# Short-Description: start pgbouncer
# Description: pgbouncer is a connection pool server and replication
#              proxy for PostgreSQL.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=pgbouncer
DAEMON=/usr/sbin/$NAME
PIDDIR=/var/run/postgresql
PIDFILE=$PIDDIR/$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

# Check if configuration exists
test -f $CONF || exit 0

. /lib/lsb/init-functions

SSD="start-stop-daemon --pidfile $PIDFILE --exec $DAEMON --quiet"

case "$1" in
  start)
    # Check if we are still disabled in /etc/default/pgbouncer
    [ "${START:-}" = "0" ] && exit 0
    log_daemon_msg "Starting PgBouncer" $NAME
    test -d $PIDDIR || install -d -o postgres -g postgres -m 2775 $PIDDIR
    $SSD --start --chuid $RUNASUSER --oknodo -- $OPTS 2> /dev/null
    log_end_msg $?
    ;;

  stop)
    log_daemon_msg "Stopping PgBouncer" $NAME
    $SSD --stop --retry 30 --oknodo
    log_end_msg $?
    ;;

  reload | force-reload)
    log_daemon_msg "Reloading PgBouncer configuration" $NAME
    $SSD --stop --signal HUP --oknodo
    log_end_msg $?
    ;;

  restart)
    # we would use "$SSD --status" here if it were available in squeeze
    $SSD --stop --signal 0
    if [ $? -eq 0 ] ; then
	OLDPID=$(cat $PIDFILE)
	log_daemon_msg "Invoking PgBouncer restart" $NAME
	su -c "$DAEMON -R $OPTS 2> /dev/null" - ${RUNASUSER%:*}
	if [ $? -ne 0 ]; then
            log_end_msg 1
            log_warning_msg "could not contact running instance"
            log_warning_msg "(If you changed the port number, run \"stop\" and \"start\" separately.)"
            exit 1
        fi
	# sleep until the process has changed PID
	for t in 0.1 0.2 0.2 0.5 1.0 1.0 2.0; do # 5s in total
	    NEWPID=$(cat $PIDFILE 2>/dev/null)
	    [ "$NEWPID" ] && [ "$NEWPID" != "$OLDPID" ] && break
	    sleep $t
	done
	$SSD --stop --signal 0
	log_end_msg $?
    else
	$0 start
    fi
    ;;

  status)
    status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
    ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}"
    exit 1
    ;;
esac