qubes-netwatcher 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. #
  3. # chkconfig: 345 92 92
  4. # description: Starts Qubes Network monitor
  5. #
  6. # Source function library.
  7. . /etc/rc.d/init.d/functions
  8. PIDFILE=/var/run/qubes/qubes-netwatcher.pid
  9. start()
  10. {
  11. type=$(/usr/bin/qubesdb-read /qubes-vm-type)
  12. start_netwatcher=$(/usr/bin/qubesdb-read /qubes-service/qubes-netwatcher 2>/dev/null)
  13. if [ -z "$start_netwatcher" ] && [ "$type" == "ProxyVM" ] || [ "$start_netwatcher" == "1" ]; then
  14. echo -n $"Starting Qubes Network monitor:"
  15. /sbin/ethtool -K eth0 sg off
  16. /usr/sbin/qubes-netwatcher &
  17. success
  18. echo ""
  19. fi
  20. return 0
  21. }
  22. stop()
  23. {
  24. if [ -r "$PIDFILE" ]; then
  25. echo -n "Stopping Qubes Network monitor:"
  26. kill -9 $(cat $PIDFILE) 2>/dev/null && success || failure
  27. echo ""
  28. fi
  29. return 0
  30. }
  31. case "$1" in
  32. start)
  33. start
  34. ;;
  35. stop)
  36. stop
  37. ;;
  38. *)
  39. echo $"Usage: $0 {start|stop}"
  40. exit 3
  41. ;;
  42. esac
  43. exit $RETVAL