I had to reinstall a whole stack on an EC2 instance because a colleague mess up the previous one (not able to SSH anymore). Long Story Short: New EC2 is running.
We have to run 2 jobs by a CRON job. Each script run perfectly of run manually.
00 3 * * 1,3,5,7 cd /home/ubuntu/my/path/; ./ingest_daily.sh &> "$(date +%Y-%m-%d-%H-%M-%S_ingestion.log)"
But the script is never launched, no log file.
So I have added a dummy cron doing:
*/1 * * * * cd /home/ubuntu/my/path/ ; echo "Hello World!" &> "$(date +%Y-%m-%d-%H-%M-%S_test.log)"
Nothing either.
pgrep cron shows me a PID so the daemon is running.
I have no idea where to look at it. I have already read some answers here but nothing seems to work.
&>is a bashism - cron's default shell is/bin/shwhich will treat it as separate&and>(i.e. place the command in the background and redirect stdout). As well,%is special and must be escaped - see for example Command with percent symbols not running in crontab. FWIW I don't see a problem withcd– steeldriver Oct 02 '21 at 17:31&>and\%. If you want to write it as an answer so I can +1 you. Thanks – Ragnar Oct 02 '21 at 19:30