pgmon/openrc/pgmon.initd
James Campbell 2afeb827ed
Improve openrc init script, add port setting
* Ensure the log directory exists with openrc

* Add a port setting to configure the port the agent listens on

* Switch to RealDictCursor

* Fix type for connection timeout
2025-04-19 00:07:15 -04:00

25 lines
583 B
Plaintext

#!/sbin/openrc-run
extra_started_commands="reload"
supervisor="supervise-daemon"
agent_name=${SVCNAME#pgmon.}
agent_name=${agent_name:-pgmon}
PGMON_USER="${PGMON_USER:-postgres}"
PGMON_GROUP="${PGMON_GROUP:-$PGMON_USER}"
CONFIG_FILE="/etc/pgmon/${agent_name}.yml"
output_log=/var/log/pgmon/${SVCNAME}.log
error_log=/var/log/pgmon/${SVCNAME}.err
start_pre() {
checkpath -f -m 0644 -o "${PGMON_USER}:${PGMON_GROUP}" "${output_log}" "${error_log}"
}
command="/usr/bin/pgmon"
command_args="'$CONFIG_FILE'"
command_background="true"
command_user="${PGMON_USER}:${PGMON_GROUP}"