You could have a look at the user and their session object.
In a scheduled event retrieve all users that have a setting of active.
For these users retrieve their session object.
If no session object set to inactive else compare the lastactive attribute to the current datetime and decide what to do then.
Run the scheduled event every 10 mins. e.g. and you would be goog to go.