Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.kamailio -- Run-Commands
4 ##
6 %config
7 kamailio_enable="$openpkg_rc_def"
8 kamailio_log_prolog="true"
9 kamailio_log_epilog="true"
10 kamailio_log_numfiles="10"
11 kamailio_log_minsize="1M"
12 kamailio_log_complevel="9"
14 %common
15 kamailio_cfgfile="@l_prefix@/etc/kamailio/kamailio.cfg"
16 kamailio_pidfile="@l_prefix@/var/kamailio/kamailio.pid"
17 kamailio_signal () {
18 [ -f $kamailio_pidfile ] && kill -$1 `cat $kamailio_pidfile`
19 }
21 %status -u @l_susr@ -o
22 kamailio_usable="no"
23 kamailio_active="no"
24 if @l_prefix@/sbin/kamailio -c >/dev/null 2>&1; then
25 kamailio_usable="yes"
26 fi
27 if rcService kamailio enable yes && kamailio_signal 0; then
28 kamailio_active="yes"
29 fi
30 echo "kamailio_enable=\"$kamailio_enable\""
31 echo "kamailio_usable=\"$kamailio_usable\""
32 echo "kamailio_active=\"$kamailio_active\""
34 %start -u @l_susr@
35 rcService kamailio enable yes || exit 0
36 rcService kamailio active yes && exit 0
37 @l_prefix@/sbin/kamctl start
39 %stop -u @l_susr@
40 rcService kamailio enable yes || exit 0
41 rcService kamailio active no && exit 0
42 @l_prefix@/sbin/kamctl stop
43 rm -f $kamailio_pidfile 2>/dev/null || true
44 sleep 2
46 %restart -u @l_susr@
47 rcService kamailio enable yes || exit 0
48 rcService kamailio active no && exit 0
49 rc kamailio stop start
51 %daily -u @l_susr@
52 rcService kamailio enable yes || exit 0
53 shtool rotate -f \
54 -n ${kamailio_log_numfiles} -s ${kamailio_log_minsize} -d \
55 -z ${kamailio_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
56 -P "${kamailio_log_prolog}" \
57 -E "${kamailio_log_epilog}; rc kamailio reload" \
58 @l_prefix@/var/kamailio/kamailio.log