aboutsummaryrefslogblamecommitdiffstats
path: root/main/unbound/unbound.initd
blob: c5c6d70c4b0aa05b466838c38c3e8cf98680c338 (plain) (tree)
1
2
3
4
5
6
7
8
9
                  
 
                            
                               

                     
                                                                                                     
                                                                        
                                                                      
 

                                                                
 
                         
                               
                      
                              

                         




                   
                              

 





                                                            
             
                   

 
          

                              
                                




                                                                   

               
#!/sbin/openrc-run

extra_commands="checkconfig"
extra_started_commands="reload"

name="unbound daemon"
description="unbound is a Domain Name Server (DNS) that is used to resolve host names to IP address."
description_checkconfig="Run syntax tests for configuration files only."
description_reload="Kills all children and reloads the configuration."

# Upper case variables are here only for backward compatibility.
: ${cfgfile:=${UNBOUND_CONFFILE:-/etc/unbound/$RC_SVCNAME.conf}}

command=/usr/sbin/unbound
command_args="-d $command_args"
command_background=yes
pidfile="/run/$RC_SVCNAME.pid"

required_files="$cfgfile"

depend() {
	need net
	use logger
	provide dns
	after auth-dns entropy
}

checkconfig() {
	ebegin "Checking $cfgfile"
	/usr/sbin/unbound-checkconf -f "$cfgfile" >/dev/null
	eend $?
}

start_pre() {
	checkconfig
}

reload() {
	start_pre || return $?

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