data usage?

Am trying to get a script to read downloads/uploads when the user login and sends me an email if the user exceeds a limit of 5GB ?.. any idea ?