dont fail just because there is no empty string
avoid sending a cron mail just for the ids ... put them in the log file
put this script logs in the log dir