require_once("DaemonWrapper.php"); $daemon = new DaemonWrapper("shuttle"); $daemon->start($argv); require_once dirname(__FILE__) . "/../../../mobi-config/mobi_lib_constants.php"; require_once LIB_ROOT . "ShuttleSchedule.php"; require_once LIB_ROOT . "NextBusReader.php"; require_once LIB_ROOT . "db.php"; require_once "apns_lib.php"; ShuttleSchedule::init(); NextBusReader::init(); $all_routes = ShuttleSchedule::get_route_list(); while ($daemon->sleep(10)) { db::ping(); // keep the database connection running $time = time(); $too_old = $time - 7200; // arbitrary 2 hour timeout threshold for now // only keep track of shuttles that are running $routes = array_filter($all_routes, array('ShuttleSchedule', 'is_running')); if (count($routes)) { foreach ($routes as $route) { // force NextBusReader to cache NextBusReader::get_predictions($route); NextBusReader::get_coordinates($route);