opensips/rc.opensips

Wed, 21 Sep 2011 14:04:16 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 21 Sep 2011 14:04:16 +0200
changeset 377
67e813202d53
parent 376
8f552d1cd671
permissions
-rw-r--r--

Introduce severe but necessary corrections and update to new vendor version.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.opensips -- Run-Commands
     4 ##
     6 %config
     7     opensips_enable="$openpkg_rc_def"
     8     opensips_rtpproxy="yes"
     9     opensips_rtpproxy_addr="127.0.0.1:12345"
    10     opensips_log_prolog="true"
    11     opensips_log_epilog="true"
    12     opensips_log_numfiles="10"
    13     opensips_log_minsize="1M"
    14     opensips_log_complevel="9"
    16 %common
    17     opensips_cfgfile="@l_prefix@/etc/opensips/opensips.cfg"
    18     opensips_pidfile="@l_prefix@/var/opensips/opensips.pid"
    19     opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid"
    20     opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock"
    21     opensips_signal () {
    22         [ -f $opensips_pidfile ] && kill -$1 `cat $opensips_pidfile`
    23     }
    24     opensips_rtpproxy_signal () {
    25         [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat $opensips_rtpproxy_pidfile`
    26     }
    28 %status -u @l_susr@ -o
    29     opensips_usable="no"
    30     opensips_active="no"
    31     if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then
    32         opensips_usable="yes"
    33     fi
    34     if rcService opensips enable yes && opensips_signal 0; then
    35         opensips_active="yes"
    36     fi
    37     echo "opensips_enable=\"$opensips_enable\""
    38     echo "opensips_usable=\"$opensips_usable\""
    39     echo "opensips_active=\"$opensips_active\""
    41 %start -u @l_susr@
    42     rcService opensips enable yes || exit 0
    43     rcService opensips active yes && exit 0
    44     if rcVarIsYes opensips_rtpproxy; then
    45         cmd="@l_prefix@/sbin/rtpproxy" \
    46         cmd="$cmd -u @l_rusr@"
    47         cmd="$cmd -l $opensips_rtpproxy_addr"
    48         cmd="$cmd -s unix:$opensips_rtpproxy_socket"
    49         cmd="$cmd -p $opensips_rtpproxy_pidfile"
    50         su @l_rusr@ -c "$cmd"
    51     fi
    52     @l_prefix@/sbin/opensipsctl start
    54 %stop -u @l_susr@
    55     rcService opensips enable yes || exit 0
    56     rcService opensips active no  && exit 0
    57     @l_prefix@/sbin/opensipsctl stop
    58     rm -f $opensips_pidfile 2>/dev/null || true
    59     if rcVarIsYes opensips_rtpproxy; then
    60         opensips_rtpproxy_signal TERM
    61     fi
    62     sleep 2
    64 %restart -u @l_susr@
    65     rcService opensips enable yes || exit 0
    66     rcService opensips active no  && exit 0
    67     rc opensips stop start
    69 %daily -u @l_susr@
    70     rcService opensips enable yes || exit 0
    71     shtool rotate -f \
    72         -n ${opensips_log_numfiles} -s ${opensips_log_minsize} -d \
    73         -z ${opensips_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
    74         -P "${opensips_log_prolog}" \
    75         -E "${opensips_log_epilog}; rc opensips reload" \
    76         @l_prefix@/var/opensips/opensips.log

mercurial