Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to give users a certain amount of traffic. Let's say user A gets 1 GB and user B get 5 GB.

I have a great script which does log all this info, however this script is called when the user disconnects (client-disconnect).

Now, my problem is the following: what if user A uses up 1 GB of data and simply never disconnects? He would be able to use thousands of GB's. Is there any way run a specific script periodically within OpenVPN (so no crontab, since OpenVPN passes environment variables).

share|improve this question
up vote 4 down vote accepted

I think you should enable the management interface on your OpenVPN server.

management 6001

Then write a program that you will periodically run from cron or something. The script will connect to the management port, issue the status command, parse the data and store it somewhere that you can use by your other scripts that disconnect clients, or prevent access. You can also issue disconnects via the management port.

share|improve this answer
Thank you, I will look into it. – Devator Jan 12 '13 at 20:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.