blob: f1009895b568871255f33701ddb4d394da89fdad (
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
|
#!/bin/sh
# PROVIDE: yate
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable the YATE:
#
# yate_enable="YES"
#
. /etc/rc.subr
name=yate
rcvar=yate_enable
command="%%PREFIX%%/bin/yate"
pidfile="/var/run/${name}.pid"
logfile="/var/log/yate/messages"
cdrfile=`awk -F= '/^file=.+/ {print $2}' %%PREFIX%%/etc/yate/cdrfile.conf`
start_precmd="yate_prestart"
stop_postcmd="yate_poststop"
yate_prestart()
{
mkdir -p $(dirname $pidfile)
if [ x$cdrfile != "x" ]; then
mkdir -p $(dirname $cdrfile)
chown yate:yate $(dirname $cdrfile)
fi
mkdir -p $(dirname $logfile)
chown yate:yate $(dirname $logfile)
}
yate_poststop()
{
rm -f $pidfile
}
yate_enable=${yate_enable="NO"}
yate_flags=${yate_flags-"-Du -d -l ${logfile} -p ${pidfile} -s"}
load_rc_config ${name}
run_rc_command "$1"
|