extract "get_connections" into a function.
add cron job support.