aports/main/pgpool/pgpool.initd

42 lines
1,004 B
Bash

#!/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
}