blob: c2cdabf27986256df604490d6ceff08e81928d47 (
plain)
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
|
#!/sbin/runscript
# pgbouncer Start the PgBouncer PostgreSQL pooler
opts="start stop reload checkconfig"
depend() {
need net
after postgresql
}
checkconfig(){
test -f /etc/pgbouncer.conf
result=$?
eend $result
}
start() {
checkconfig || return 1
ebegin "Starting pgbouncer as pgbouncer user"
# if [ -f "/var/run/postgresql/pgbouncer.pid" ] ; then
# rm -f "/var/run/postgresql/pgbouncer.pid"
# fi
PIDFILE="/var/run/postgresql/pgbouncer.pid"
TIMEOUT=${TIMEOUT:-10}
PGBOUNCER_OPTS="-d -u pgbouncer /etc/pgbouncer.conf"
/usr/bin/pgbouncer ${PGBOUNCER_OPTS}
let i=0
while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do
sleep 1 && i=$(expr $i + 1)
done
test $i -le ${TIMEOUT}
eend $?
}
stop() {
ebegin "Stopping pgbouncer"
start-stop-daemon --stop --quiet --pidfile /var/run/postgresql/pgbouncer.pid
eend $?
}
reload() {
ebegin "Reloading pgbouncer configuration"
start-stop-daemon --stop --pidfile /var/run/postgresql/pgbouncer.pid --signal HUP
}
|