accounting 924 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: accounting
  4. # Required-Start: $network $remote_fs $syslog
  5. # Required-Stop: $network $remote_fs $syslog
  6. # Should-Start: network-manager
  7. # Should-Stop: network-manager
  8. # X-Start-Before: openvpn
  9. # X-Interactive: true
  10. # Default-Start: 2 3 4 5
  11. # Default-Stop: 0 1 6
  12. # Short-Description: Accounting daemon for Openvpn VPN service
  13. # Description: This script will start the accounting script for OpenVPN
  14. ### END INIT INFO
  15. PATH=/sbin:/bin
  16. . /lib/lsb/init-functions
  17. case "$1" in
  18. start)
  19. /usr/bin/python2 /etc/openvpn/vpn_acct.py -s graphite-dev.illyse.org /var/run/openvpn/acct vpn1
  20. ;;
  21. restart|reload|force-reload)
  22. shift
  23. $0 stop ${@}
  24. sleep 1
  25. $0 start ${@}
  26. ;;
  27. stop)
  28. kill `cat /var/run/vpn_acct.pid`
  29. rm -f /var/run/vpn_acct.pid
  30. ;;
  31. *)
  32. echo "Usage: $0 start|stop|restart" >&2
  33. exit 3
  34. ;;
  35. esac