Many ISPs cap the amount of traffic their customers can utilize before charging them overages but do not easily allow customers a means to monitor their situation without lag. Many times days behind. An easy answer to that is to install a router in your home. This also gives you the ability to set limits and cut off traffic before or at the imposed cap with varying amounts of success depending on the product you choose.
This can be handy but what if you want a significant other or children to access this information without giving them access the router itself? Below is a very simple script that can be scheduled in a cron to parse this information and place it on your local web server. I’m hoping to expand this at a later date and maybe add charting. If you have any other techniques feel free to share them below!
This script has been tested on both Red Hat Linux and Ubuntu. The script will lock out accounts that have not logged in for 30 days or more. You should keep a couple months of lastlog information on the system. This script does not lock out system accounts (UID under 100) and also does not act against user accounts that have never logged on (ex. new users). Also has email notification of accounts that have been locked. Simply schedule to run daily in your cron.
This script is a few years old and many newer versions of Linux accomplish this with PAM modules but there are instances in which this script could be useful.