Bug 9988: Refactor the cron script