Original code for autocron, before cleanup.