aboutsummaryrefslogtreecommitdiff
path: root/net/asterisk/files/asterisk.in
blob: a612850c5603b33fd2d378f836140815bd2ce3bc (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
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: asterisk
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#
# asterisk_enable="YES"
#

. /etc/rc.subr

name=asterisk
rcvar=asterisk_enable

extra_commands="reload"

stop_cmd="asterisk_stop"
reload_cmd="asterisk_reload"

command="%%PREFIX%%/sbin/asterisk"
command_args="-n -U %%ASTERISK_USER%%"
pidfile=${asterisk_pidfile:-"/var/run/asterisk/asterisk.pid"}

asterisk_stop() {
  echo 'Stopping asterisk'
  $command -nqrx 'core stop now'
}

asterisk_reload() {
  echo 'Reloading asterisk'
  $command -nqrx 'reload'
}

load_rc_config $name

asterisk_enable=${asterisk_enable:-"NO"}

run_rc_command "$1"