I am trying to use the whenever gem to execute a couple of rake tasks. It appears to set up the cron tasks correctly - info here is from the mail output that is produced. Here's an example of the command executed:
/bin/bash -l -c 'cd /path/to/deployed/app && RAILS_ENV=production
rake clean:my:task --silent'
And here are some of the environment variables:
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
And here is the error that follows:
/bin/bash: /usr/bin/rake: /usr/bin/ruby: bad interpreter: No such file or directory
When i'm logged in i can run these rake tasks from the same directory, but when i run
which ruby
i get
/usr/local/bin/ruby
There does appear to be a 'rake' in /usr/bin, but running
/usr/bin/rake -T
gives me the same error:
-bash: /usr/bin/rake: /usr/bin/ruby: bad interpreter: No such file or directory
What would be the best way to resolve this?