Emulate cron behavior

Based on <http://stackoverflow.com/a/2135612/96588> and <http://stackoverflow.com/questions/2135478/how-to-simulate-the-environment-cron-executes-a-script-with#comment11293746_2135635>.