I have the following shell script: /var/local/myapp/bin/import
#!/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.
>> /var/log/myapp/import.loginstead of overwriting> /var/log/myapp/import.logif you really do want to run it every minuite. – Zypher Jul 18 '10 at 21:14* * * * * PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin /var/local/myapp/bin/import >> /var/local/tvserver/import.log 2>&1and it works! – Sean Clark Hess Jul 18 '10 at 21:21