summaryrefslogtreecommitdiff
path: root/main/pgpool/pgpool.initd
blob: 2d676a1c7f42ad39a721ed3ca28ba783d0eb38b5 (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
#!/sbin/openrc-run

name="pgpool-II"

: ${command_user:="postgres:postgres"}
: ${config_file:="/etc/pgpool/pgpool.conf"}
: ${hba_file:="/etc/pgpool/pool_hba.conf"}
: ${key_file:="/etc/pgpool/pool_key"}
: ${pcp_file:="/etc/pgpool/pcp.conf"}
: ${logfile="/var/log/pgpool/pgpool.log"}
: ${start_wait:=2}

command="/usr/bin/pgpool"
command_args="
	--dont-detach
	--config-file $config_file
	--hba-file $hba_file
	--key-file $key_file
	--pcp-file $pcp_file
	$command_args
	"
command_background="yes"

pidfile="/run/$RC_SVCNAME.pid"
error_log="$logfile"
start_stop_daemon_args="--wait $start_wait"
# The leading space is to avoid fallback to $start_stop_daemon_args when this
# is empty (supervise-daemon doesn't support --wait).
supervise_daemon_args=" $supervise_daemon_args"

required_files="$config_file"

depend() {
	need net
	after firewall
	use postgresql
}

start_pre() {
	# pgpool creates /run/pgpool/pgpool.pid file even with --dont-detach. >_<
	checkpath -d -m 0750 -o "$command_user" /run/pgpool
}