aboutsummaryrefslogblamecommitdiffstats
path: root/community/repmgr/repmgrd.initd
blob: dc695fb9b4784914c17f4bc860efe95e173d7d44 (plain) (tree)
1
2
3
4
5
6
7
8
9

                  



                                         
                                
                                     
 
                          
                                                                                   
                        

                                                         
                              
                                             
 

                         



                       
 




                                                                    









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