detect if run by cron or from console and change path to key file accordingly