script that drops old ovpn connections

Hi. Sometimes the problem is that the freeze ovpn connection and they are active for a month or more.
I am writing a script that will kill active ovpn connections whose uptime is more than 3 days

I found a way to find these connections:
/interface ovpn-server print where uptime >3d

I can’t understand how to drop these connections in a script
If someone has a similar experience, tell me please.

Not easy, since MT does not follow ieee standards on time format, that it makes it nearly impossible to calculate time difference.

Take a look at this post on how to convert MT time format to Linux epoch format that you can use to convert it. Then it should be possible to calculate time difference. http://forum.mikrotik.com/t/i-did-it-script-to-compute-unix-time/68576/9