summaryrefslogtreecommitdiff
blob: ca8b8c95b591e86990fcab46b7d61a49f09fd6be (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
#!/sbin/runscript

PIDFILE=/var/run/pgbouncer/pgbouncer.pid

opts="start stop reload"

depend() {
	need net
	after postgresql
}

start() {
	mkdir -p /var/run/pgbouncer
	chown pgbouncer:pgbouncer /var/run/pgbouncer

	ebegin "Starting pgbouncer"
	
	start-stop-daemon --start --pidfile ${PIDFILE} \
		--exec /usr/bin/pgbouncer -- -q -d -u pgbouncer /etc/pgbouncer.conf
	eend $? "Failed to start pgbouncer"
}

stop() {
	ebegin "Stopping pgbouncer"
	start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
	eend $?
} 

reload() {
	ebegin "Gracefully reloading pgbouncer"
	start-stop-daemon --stop --oknodo --signal HUP \
		--pidfile ${PIDFILE}
	eend $?
}