blob: 05ec2d737863dd04e4b94b2ed2d4927113fa414e (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/sh
# PROVIDE: kamailio
# REQUIRE: NETWORKING SERVERS DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable this service
# at system startup:
#
# kamailio_enable (bool):
# Set to NO by default
# Set it to YES to enable kamailio
# kamailio_user (string)
# Set user to run kamailio
# Default is "%%KAMAILIO_USER%%"
# kamailio_group (string)
# Set group to run kamailio
# Default is "%%KAMAILIO_GROUP%%"
# kamailio_pidfile (string)
# Set full path to pid file
# Default is "%%KAMAILIO_RUNDIR%%/kamailio.pid"
#
. /etc/rc.subr
name=kamailio
rcvar=kamailio_enable
load_rc_config ${name}
: ${kamailio_enable:="NO"}
: ${kamailio_user:="%%KAMAILIO_USER%%"}
: ${kamailio_group:="%%KAMAILIO_GROUP%%"}
: ${kamailio_pidfile:="%%KAMAILIO_RUNDIR%%/kamailio.pid"}
pidfile="${kamailio_pidfile}"
required_files="%%ETCDIR%%/kamailio.cfg"
command="/usr/local/sbin/kamailio"
command_args="-P ${pidfile}"
start_precmd="kamailio_start_precmd"
restart_precmd="kamailio_checkconfig"
reload_precmd="kamailio_checkconfig"
configtest_cmd="kamailio_checkconfig"
extra_commands="configtest"
kamailio_start_precmd()
{
if [ ! -d "%%KAMAILIO_RUNDIR%%" ]; then
install -d -m 0750 -o ${kamailio_user} -g ${kamailio_group} "%%KAMAILIO_RUNDIR%%"
fi
}
kamailio_checkconfig()
{
echo "Performing sanity check on ${name} configuration:"
eval ${command} ${kamailio_flags} -c >/dev/null
}
run_rc_command $1
|