You can take a look in the net.cpp file under the world folder. Find this code below because here is where you would want to do that at. The InterserverTimer is currently set at 10000ms. If you don't want to include a new function with the InterserverTimer you could copy it and create a new timer.
Code:
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
AsyncLoadVariables(dbasync, &database);
if (Config->LoginHost.length() && loginserver.Connected() == false) {
#ifdef WIN32
_beginthread(AutoInitLoginServer, 0, NULL);
#else
pthread_t thread;
pthread_create(&thread, NULL, &AutoInitLoginServer, NULL);
#endif
}
}