opensips/rc.opensips

Tue, 28 Aug 2012 18:29:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:29:30 +0200
changeset 534
d2d0020cfafa
parent 376
8f552d1cd671
permissions
-rw-r--r--

Update from Drupal 6.x to 7.x and introduce several new HTML5 themes. Because
many themes from Drupal 6.x have since been abandoned, left unmaintained, or
not ported to Drupal 7.x, this package has changed in size and utility.

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

mercurial