aboutsummaryrefslogtreecommitdiffstats
path: root/community/repmgr/repmgrd.initd
blob: dc695fb9b4784914c17f4bc860efe95e173d7d44 (plain) (blame)
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
#!/sbin/openrc-run

name=repmgrd
extra_started_commands="reload"
description_reload="Reload configuration"

: ${cfgfile:="/etc/repmgr.conf"}
: ${command_wait:=50}  # milliseconds

command="/usr/bin/repmgrd"
command_args="--config-file=$cfgfile --no-pid-file --daemonize=false $command_args"
command_background="yes"
# "user" variable is here for backward compatibility only
command_user="${command_user:-${user:-postgres}}"
pidfile="/run/$RC_SVCNAME.pid"
start_stop_daemon_args="--wait $command_wait"

required_files="$cfgfile"

depend() {
	need postgresql
	use net logger
}

[ -z "$supervisor" ] && start() {
	# If fails, start again in foreground to get error messages.
	ssd_start || command_background=no ssd_start
}

reload() {
	ebegin "Reloading $name configuration"

	if [ "$supervisor" ]; then
		$supervisor "$RC_SVCNAME" --signal HUP
	else
		start-stop-daemon --signal HUP --pidfile "$pidfile"
	fi
	eend $?
}