I have the following command that works well when I execute it manually :
sendreport --date_start=`date +%Y-%m-19 -d "-1 month"` --date_end=`date +%Y-%m-19` --to=myemail@mydomain.ch
My problem is when I execute the same command via cron task, nothing happens. If I replace the part that set the date dynamically, by an actual date, then the cron works. For example, this works on cron :
sendreport --date_start=2017-12-19 --date_end=2018-01-19 --to=myemail@mydomain.ch
Also tried this way, and again it works if I execute it manually, but nothing happens if it is cron :
sendreport --date_start=$(date +%Y-%m-19 -d "-1 month") --date_end=$(date +%Y-%m-19) --to=myemail@mydomain.ch
Finally, also tried declaring the value of dates in variables, and again cron won't work.
The script sendreport is receiving empty value for date parameters when executed by cron.
Thank you in avance for your help.