more debugging for the cron task
added conditionals so we can use the same script locally and on production
added conditionals so we can use the same script locally and on production