Make script able to start from cron