I'm experiencing a small problem with a cronjob that runs a script of mine.
The script looks something like this, it is named
#!/bin/bash cd /work/directory /some/command.sh > reports/report_$(date -d "1 day ago" +%Y%m%d).txt
This is obviously a little simplified, but after writing the output to some file that file gets attached to an email and sent to me.
When I run this "manually" it works fine and the report file has contents.
Then I created a cronjob using crontab-generator.org which runs that script each morning at 7 am and mutes the output of the script.
0 7 * * * /path/to/script/create_report.sh >/dev/null 2>&1
When the cronjob runs the script, the report files get created and sent to me, but they're empty. I could probably figure out a way around this behaviour myself, but I didn't expect this to happen, can someone explain to me how this happened and maybe point out the correct way to make something like this happen?
To clarify: I'm not interested in the output of
create_report.sh but the report-File it creates.
Thanks in advance!