| 1 | #!/sbin/openrc-run |
| 2 | |
| 3 | name="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 | |
| 13 | command="/usr/bin/pgpool" |
| 14 | command_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 | " |
| 22 | command_background="yes" |
| 23 | |
| 24 | pidfile="/run/$RC_SVCNAME.pid" |
| 25 | error_log="$logfile" |
| 26 | start_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). |
| 29 | supervise_daemon_args=" $supervise_daemon_args" |
| 30 | |
| 31 | required_files="$config_file" |
| 32 | |
| 33 | depend() { |
| 34 | need net |
| 35 | after firewall |
| 36 | use postgresql |
| 37 | } |
| 38 | |
| 39 | start_pre() { |
| 40 | # pgpool creates /run/pgpool/pgpool.pid file even with --dont-detach. >_< |
| 41 | checkpath -d -m 0750 -o "$command_user" /run/pgpool |
| 42 | } |