aboutsummaryrefslogtreecommitdiffstats
path: root/lang/erlang/files/epmd.in
blob: 1c9dc45c45bceb2d28ae58ba71f23728b6b04c5e (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
40
41
#!/bin/sh

# PROVIDE: epmd
# REQUIRE: DAEMON mountlate
#
# Add the following line to /etc/rc.conf to enable epmd:
#
# epmd_enable="YES"
#
# Configure optional flags with:
# epmd_opts="-address 127.0.0.1"

. /etc/rc.subr

name=epmd
rcvar=epmd_enable

load_rc_config ${name}

: ${epmd_enable="NO"}
: ${epmd_opts:-""}
: ${epmd_user="beam"}

procname="daemon"
pidfile="/var/run/epmd/epmd.pid"
command="/usr/sbin/daemon"
command_args="-f -r -P ${pidfile} %%PREFIX%%/bin/epmd ${epmd_opts}"
command_user="${epmd_user}"

start_precmd="epmd_precmd"

epmd_precmd()
{
	if [ ! -d "/var/run/epmd" ]; then
		install -d -o ${epmd_user} -g ${epmd_user} /var/run/epmd
	fi
	# Ensure beam user can write pidfile
	install -m 644 -g ${epmd_user} -o ${epmd_user} /dev/null ${pidfile}
}

run_rc_command "$1"