This question already has an answer here:
I have the following shell script:
#!/bin/bash # Move to base directory cd $(dirname $0) cd .. # Execute and bail if one of them fails cake compile cake tms:fetch cake tms:fetch:clean cake tms:split cake tms:injest:main cake tms:injest:schedules
I'm trying to run it from cron. All users have access to
cake. However, when I run this script with cron, I get the following error (on every cake line):
/var/local/myapp/bin/import: line 13: cake: command not found
Here's my crontab
* * * * * /var/local/myapp/bin/import
Also, I can't figure out an easy way to redirect the stdout of bin/import to a file when run from cron. Adding
> /var/local/myapp/import.log to the end of the cron statement just truncates import.log - the only way I can do it is to add
exec &> import.log to bin/import itself, which isn't what I want to do at all, because when I run it by hand I want to see the output on the screen.
Everything works perfectly when I just type
/var/local/myapp/bin/import from my terminal.