diff --git a/debian/ngcp-rtpengine-daemon.init b/debian/ngcp-rtpengine-daemon.init index 432a06082..85123cc00 100755 --- a/debian/ngcp-rtpengine-daemon.init +++ b/debian/ngcp-rtpengine-daemon.init @@ -132,6 +132,7 @@ case "$1" in ;; esac fi + set -e log_daemon_msg "Starting $DESC: $NAME" if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then set +e @@ -208,68 +209,9 @@ case "$1" in log_end_msg $? ;; restart|force-reload) - - log_daemon_msg "Restarting $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile \ - "$PIDFILE" --exec $DAEMON - if [ "$?" -ne 0 ]; then - return $? - fi - rm -f $PIDFILE - if [ -x "/usr/sbin/ngcp-check_active" ]; then - /usr/sbin/ngcp-check_active -q - status=$? - case "${status}" in - 0|3) - log_progress_msg "Active node or transition." - ;; - *) - log_progress_msg "Ignored start action in inactive node ($status)" - exit 0 - ;; - esac - 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 - fi - if [ -e /proc/rtpengine/control ]; then - echo "del $TABLE" > /proc/rtpengine/control 2>/dev/null - fi - iptables -D INPUT -j mediaproxy 2> /dev/null - iptables -F mediaproxy 2> /dev/null - iptables -X mediaproxy 2> /dev/null - ip6tables -D INPUT -j mediaproxy 2> /dev/null - ip6tables -F mediaproxy 2> /dev/null - ip6tables -X mediaproxy 2> /dev/null - rmmod xt_MEDIAPROXY 2>/dev/null - rmmod xt_RTPENGINE 2>/dev/null - modprobe xt_RTPENGINE - if [ "$CREATE_IPTABLES_CHAIN" != "no" ]; then - iptables -D INPUT -j rtpengine 2> /dev/null - ip6tables -D INPUT -j rtpengine 2> /dev/null - iptables -N rtpengine 2> /dev/null - iptables -I INPUT -j rtpengine - ip6tables -N rtpengine 2> /dev/null - ip6tables -I INPUT -j rtpengine - fi - if iptables -C INPUT -j rtpengine 1> /dev/null 2> /dev/null && iptables -n --list rtpengine 1> /dev/null 2> /dev/null; then - ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null - iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null - iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE" - ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE" - else - echo "" - echo "Missing rtpengine iptables chain - not starting" - exit 0 - fi - set -e - fi - start-stop-daemon --start --quiet --pidfile \ - "$PIDFILE" --exec "$DAEMON" -- $OPTIONS - log_end_msg $? + $0 stop + sleep 1 + $0 start ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?