projects/aports·blob master · refs

42 lines · 1004 B

1#!/sbin/openrc-run
2
3name="pgpool-II"
4
5: ${command_user:="postgres:postgres"}
6: ${config_file:="/etc/pgpool/pgpool.conf"}
7: ${hba_file:="/etc/pgpool/pool_hba.conf"}
8: ${key_file:="/etc/pgpool/pool_key"}
9: ${pcp_file:="/etc/pgpool/pcp.conf"}
10: ${logfile="/var/log/pgpool/pgpool.log"}
11: ${start_wait:=2}
12
13command="/usr/bin/pgpool"
14command_args="
15 --dont-detach
16 --config-file $config_file
17 --hba-file $hba_file
18 --key-file $key_file
19 --pcp-file $pcp_file
20 $command_args
21 "
22command_background="yes"
23
24pidfile="/run/$RC_SVCNAME.pid"
25error_log="$logfile"
26start_stop_daemon_args="--wait $start_wait"
27# The leading space is to avoid fallback to $start_stop_daemon_args when this
28# is empty (supervise-daemon doesn't support --wait).
29supervise_daemon_args=" $supervise_daemon_args"
30
31required_files="$config_file"
32
33depend() {
34 need net
35 after firewall
36 use postgresql
37}
38
39start_pre() {
40 # pgpool creates /run/pgpool/pgpool.pid file even with --dont-detach. >_<
41 checkpath -d -m 0750 -o "$command_user" /run/pgpool
42}