action.sh 785 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. action="$1"
  3. CONFPATH="/etc/speaker.conf"
  4. case ${action} in
  5. set_rtsp)
  6. rtsp_access="`sysconf ${CONFPATH} get ipc rtsp_access`"
  7. if [ "foo${rtsp_access}" = "fooyes" ];then
  8. echo "1" > /proc/sys/net/ipv4/ip_forward
  9. iptables -F && iptables -t nat -F
  10. iptables -t nat -A PREROUTING -p tcp --dport 554 -j DNAT --to-destination 10.231.132.139:554
  11. exit 0
  12. else
  13. echo "0" > /proc/sys/net/ipv4/ip_forward
  14. iptables -F && iptables -t nat -F
  15. exit 0
  16. fi
  17. ;;
  18. set_yaml)
  19. sed -i '/^!!omap/d' /tmp/conf
  20. sed -i 's/!!omap//g' /tmp/conf
  21. sed -i 's/^- //g' /tmp/conf
  22. sed -i 's/^ - / /g' /tmp/conf
  23. ;;
  24. *)
  25. exit 0
  26. ;;
  27. esac