adding when condition to cron