Browse Source

Initial commit

Mathieu 10 years ago
parent
commit
4afdce96f4
1 changed files with 37 additions and 0 deletions
  1. 37 0
      contrib/accounting

+ 37 - 0
contrib/accounting

@@ -0,0 +1,37 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          accounting
+# Required-Start:    $network $remote_fs $syslog
+# Required-Stop:     $network $remote_fs $syslog
+# Should-Start:      network-manager
+# Should-Stop:       network-manager
+# X-Start-Before:    openvpn
+# X-Interactive:     true
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Accounting daemon for Openvpn VPN service
+# Description: This script will start the accounting script for OpenVPN
+### END INIT INFO
+
+PATH=/sbin:/bin
+
+. /lib/lsb/init-functions
+
+case "$1" in
+  start)
+	python /etc/openvpn/vpn_acct.py -s graphite-dev.illyse.org /var/run/openvpn/acct vpn1
+	;;
+  restart|reload|force-reload)
+    shift
+    $0 stop ${@}
+    sleep 1
+    $0 start ${@}
+	;;
+  stop)
+	kill `cat /var/run/vpn_acct.pid`
+	;;
+  *)
+	echo "Usage: $0 start|stop|restart" >&2
+	exit 3
+	;;
+esac