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.
michael@389 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@389 | 2 | ## |
michael@389 | 3 | ## rc.kamailio -- Run-Commands |
michael@389 | 4 | ## |
michael@389 | 5 | |
michael@389 | 6 | %config |
michael@389 | 7 | kamailio_enable="$openpkg_rc_def" |
michael@389 | 8 | kamailio_log_prolog="true" |
michael@389 | 9 | kamailio_log_epilog="true" |
michael@389 | 10 | kamailio_log_numfiles="10" |
michael@389 | 11 | kamailio_log_minsize="1M" |
michael@389 | 12 | kamailio_log_complevel="9" |
michael@389 | 13 | |
michael@389 | 14 | %common |
michael@389 | 15 | kamailio_cfgfile="@l_prefix@/etc/kamailio/kamailio.cfg" |
michael@389 | 16 | kamailio_pidfile="@l_prefix@/var/kamailio/kamailio.pid" |
michael@389 | 17 | kamailio_signal () { |
michael@389 | 18 | [ -f $kamailio_pidfile ] && kill -$1 `cat $kamailio_pidfile` |
michael@389 | 19 | } |
michael@389 | 20 | |
michael@389 | 21 | %status -u @l_susr@ -o |
michael@389 | 22 | kamailio_usable="no" |
michael@389 | 23 | kamailio_active="no" |
michael@389 | 24 | if @l_prefix@/sbin/kamailio -c >/dev/null 2>&1; then |
michael@389 | 25 | kamailio_usable="yes" |
michael@389 | 26 | fi |
michael@389 | 27 | if rcService kamailio enable yes && kamailio_signal 0; then |
michael@389 | 28 | kamailio_active="yes" |
michael@389 | 29 | fi |
michael@389 | 30 | echo "kamailio_enable=\"$kamailio_enable\"" |
michael@389 | 31 | echo "kamailio_usable=\"$kamailio_usable\"" |
michael@389 | 32 | echo "kamailio_active=\"$kamailio_active\"" |
michael@389 | 33 | |
michael@389 | 34 | %start -u @l_susr@ |
michael@389 | 35 | rcService kamailio enable yes || exit 0 |
michael@389 | 36 | rcService kamailio active yes && exit 0 |
michael@408 | 37 | @l_prefix@/sbin/kamctl start |
michael@389 | 38 | |
michael@389 | 39 | %stop -u @l_susr@ |
michael@389 | 40 | rcService kamailio enable yes || exit 0 |
michael@389 | 41 | rcService kamailio active no && exit 0 |
michael@408 | 42 | @l_prefix@/sbin/kamctl stop |
michael@389 | 43 | rm -f $kamailio_pidfile 2>/dev/null || true |
michael@389 | 44 | sleep 2 |
michael@389 | 45 | |
michael@389 | 46 | %restart -u @l_susr@ |
michael@389 | 47 | rcService kamailio enable yes || exit 0 |
michael@389 | 48 | rcService kamailio active no && exit 0 |
michael@389 | 49 | rc kamailio stop start |
michael@389 | 50 | |
michael@389 | 51 | %daily -u @l_susr@ |
michael@389 | 52 | rcService kamailio enable yes || exit 0 |
michael@389 | 53 | shtool rotate -f \ |
michael@389 | 54 | -n ${kamailio_log_numfiles} -s ${kamailio_log_minsize} -d \ |
michael@389 | 55 | -z ${kamailio_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \ |
michael@389 | 56 | -P "${kamailio_log_prolog}" \ |
michael@389 | 57 | -E "${kamailio_log_epilog}; rc kamailio reload" \ |
michael@389 | 58 | @l_prefix@/var/kamailio/kamailio.log |
michael@389 | 59 |