aboutsummaryrefslogtreecommitdiff
path: root/net/freeswitch/files/freeswitch.in
blob: 24392472cb06b29352f449c05abd91281929d692 (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
46
47
48
49
50
#!/bin/sh

# PROVIDE: freeswitch
# REQUIRE: DAEMON
# KEYWORD: FreeBSD

. %%RC_SUBR%%

name=freeswitch
rcvar=`set_rcvar`

command=%%PREFIX%%/freeswitch/bin/freeswitch
command_args="-nc"

pidfile=${freeswitch_pidfile:-"%%PREFIX%%/freeswitch/log/freeswitch.pid"}

freeswitch_enable=${freeswitch_enable-"YES"}

start_cmd="freeswitch_start"
stop_precmd="freeswitch_stop"
restart_cmd="freeswitch_restart"

sig_stop=KILL  

load_rc_config $name

freeswitch_stop () {
        echo "Stopping Freeswitch."
        %%PREFIX%%/freeswitch/bin/freeswitch -stop
        sleep 1
        return 0
}

freeswitch_start () {                                                            
        echo "Starting FreeSwitch."                                              
        /usr/sbin/daemon -f /bin/sh -c "$command"
        sleep 1
        return
}

freeswitch_restart () {
        echo "ReStarting FreeSwitch."
        freeswitch_stop                                                      
        freeswitch_start
        sleep 1
        return
} 

run_rc_command "$1"