#!/bin/bash

DB='vpn'
DBUSER='openvpn'

mysql -u $DBUSER -e "UPDATE log SET bytes_rcvd='$bytes_received', bytes_sent='$bytes_sent', ended_at=NOW( ) WHERE username='$common_name' ORDER BY started_at DESC LIMIT 1" $DB

exit 0
