How to run check on each page load? I would like to run a check on each page load.  This only concerns the front end and not the admin dashboard.

Basically what I would like to do is:
1) User hits a URL in the drupal site. 
2) A server-side check is ran. If the check passes, run some logic.

How would I accomplish this? 

I'm guessing that I can use a hook, but what hook would that be? 

Thanks.
hook_init() is run on every page load except for cached pages, so depending on your use case that might be an option.

function MYMODULE_init() {
  // Custom logic
}


hook_boot() is run on every page, including cached pages, so might be more useful (again depending on your use case). However if you have complex logic to process this will obviously slow down the build of every page, even those that are cached.

function MYMODULE_boot() {
  // Custom logic
}


If you want to check whether or not the current path falls under '/admin' you can use a check like this in either function:

if (arg(0) == 'admin') {
  // ...
}


This won't work for node edit pages, for example, who's path doesn't have '/admin' in it; but short of invoking hook_admin_paths() and testing the current URL against each of the paths returned, I'm not sure how you'd reliably test for that anyway.