|
|
|
|
@ -37,6 +37,8 @@ set -e
|
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
|
|
|
|
|
|
OPTIONS=""
|
|
|
|
|
START_OPTIONS=""
|
|
|
|
|
MODPROBE_OPTIONS=""
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$INTERFACES" ]; then
|
|
|
|
|
for interface in $INTERFACES; do
|
|
|
|
|
@ -111,6 +113,37 @@ if test "$LOG_STDERR" = "yes" ; then
|
|
|
|
|
OPTIONS="$OPTIONS --log-stderr"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# check if directory for pid file needs to be created
|
|
|
|
|
|
|
|
|
|
PIDDIR=$(dirname "$PIDFILE")
|
|
|
|
|
DO_DIR_CHOWN=0
|
|
|
|
|
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
|
|
|
|
|
mkdir -p "$PIDDIR"
|
|
|
|
|
DO_DIR_CHOWN=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# handle requested setuid/setgid
|
|
|
|
|
|
|
|
|
|
if ! test -z "$SET_USER"; then
|
|
|
|
|
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
|
|
|
|
|
UID=$(id -u "$SET_USER" 2> /dev/null)
|
|
|
|
|
test -z "$UID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_uid=$UID"
|
|
|
|
|
if test -z "$SET_GROUP"; then
|
|
|
|
|
GID=$(id -g "$SET_USER" 2> /dev/null)
|
|
|
|
|
test -z "$GID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$GID"
|
|
|
|
|
fi
|
|
|
|
|
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if ! test -z "$SET_GROUP"; then
|
|
|
|
|
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
|
|
|
|
|
GID=$(grep "^$SET_GROUP:" /etc/group | cut -d: -f3 2> /dev/null)
|
|
|
|
|
test -z "$GID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$GID"
|
|
|
|
|
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
if [ -x /usr/sbin/ngcp-virt-identify ]; then
|
|
|
|
|
if /usr/sbin/ngcp-virt-identify --type container; then
|
|
|
|
|
VIRT="yes"
|
|
|
|
|
@ -137,7 +170,7 @@ case "$1" in
|
|
|
|
|
log_daemon_msg "Starting $DESC: $NAME"
|
|
|
|
|
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
|
|
|
|
|
set +e
|
|
|
|
|
modprobe xt_RTPENGINE
|
|
|
|
|
modprobe xt_RTPENGINE $MODPROBE_OPTIONS
|
|
|
|
|
if [ -e /proc/mediaproxy/control ]; then
|
|
|
|
|
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
|
|
|
|
|
fi
|
|
|
|
|
@ -173,7 +206,7 @@ case "$1" in
|
|
|
|
|
set -e
|
|
|
|
|
fi
|
|
|
|
|
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
|
|
|
|
|
--exec "$DAEMON" -- $OPTIONS || log_progress_msg " already running"
|
|
|
|
|
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
|
|
|
|
|
log_end_msg $?
|
|
|
|
|
;;
|
|
|
|
|
stop)
|
|
|
|
|
@ -184,6 +217,7 @@ case "$1" in
|
|
|
|
|
return $?
|
|
|
|
|
fi
|
|
|
|
|
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
|
|
|
|
|
sleep 1
|
|
|
|
|
set +e
|
|
|
|
|
if [ -e /proc/mediaproxy/control ]; then
|
|
|
|
|
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
|
|
|
|
|
|