Score:0

CRON doesn't run

tr flag

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.

hr flag
`&>` is a bashism - cron's default shell is `/bin/sh` which 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](https://askubuntu.com/a/434042/178692). FWIW I don't see a problem with `cd`
Ragnar avatar
tr flag
@steeldriver you are right about both `&>` and `\%`. If you want to write it as an answer so I can +1 you. Thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.