The Single User Servers of a User will be automatically stopped while he is logging out. This is because of the function in Logout handler: _shutdown_servers
But if users are using a shared collaborative Server. Multiple users have access to it. Using function _shutdown_servers is not suitable in this case.
So i need another logic to shut down the shared/collaborative Server:
If the last user is logging out, the server will be shut down. Is there any funtion to realize this log out logic?
There is no way to know how many users are “logged in” to a server, because this information is stored in browsers, not servers (a browser can logout via cookie expiry, etc. without any interaction with the server).
In general, “shutdown on logout” is not a safe operation, because it makes a lot of assumptions that can’t be verified, e.g. all users have exactly one browser session. That’s good enough for most real human users that it’s relatively safe, and you probably won’t get too many false shutdowns.
You can try combining the logout with setting a relatively short idle timeout, such that logging out of the server starts a timeout (say 5-10 minutes) and it shuts down if there is no activity within that time frame.