qubes-netwatcher 795 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. #
  3. # chkconfig: 345 93 93
  4. # description: Starts Qubes Network monitor
  5. #
  6. # Source function library.
  7. . /etc/rc.d/init.d/functions
  8. # Source Qubes library.
  9. . /usr/lib/qubes/init/functions
  10. PIDFILE=/var/run/qubes/qubes-netwatcher.pid
  11. start()
  12. {
  13. have_qubesdb || return
  14. if qsvc qubes-netwatcher ; then
  15. echo -n $"Starting Qubes Network monitor:"
  16. /sbin/ethtool -K eth0 sg off
  17. /usr/sbin/qubes-netwatcher &
  18. success
  19. echo ""
  20. fi
  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