summaryrefslogtreecommitdiff
path: root/net/freeswitch-core/files/freeswitch.in
blob: d38f868d57a9775546bf763cf54ebff5642d195d (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
42
43
44
45
#!/bin/sh

# PROVIDE: freeswitch
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable freeswitch:
#
# freeswitch_enable="YES"
#
#
#  freeswitch_user="freeswitch"
#  freeswitch_group="freeswitch"

. /etc/rc.subr

name=freeswitch
rcvar=freeswitch_enable

load_rc_config $name

: ${freeswitch_enable="NO"}
: ${freeswitch_user="freeswitch"}
: ${freeswitch_group="freeswitch"}
: ${freeswitch_flags="-nc -waste"}

command=%%PREFIX%%/bin/freeswitch
command_args="-u ${freeswitch_user} -g ${freeswitch_group}"

pidfile=${freeswitch_pidfile:-"/var/run/freeswitch/freeswitch.pid"}

start_precmd="${name}_prestart"
stop_cmd="${name}_stop"

freeswitch_stop () {
        echo "Stopping FreeSWITCH."
        %%PREFIX%%/bin/freeswitch -stop
	wait_for_pids `cat $pidfile`
}

freeswitch_prestart () {
	install -d -o ${freeswitch_user} -m755 /var/run/${name}
}

run_rc_command "$1"