I have a simple ruby script, hello.rb
:
#!/usr/bin/env ruby
puts 'hello'
It runs ok at the command line:
# /usr/local/src/hello/hello.rb
hello
However, if I put it in cron
:
* * * * * /usr/local/src/hello/hello.rb >> /usr/local/src/hello/hello.log 2>&1
There are errors in the log file:
/usr/bin/env: ruby: No such file or directory
/usr/bin/env: ruby: No such file or directory
...
/usr/bin/env: ruby: No such file or directory
/usr/bin/env ruby
runs ok at command line though:
# /usr/bin/env ruby -v
ruby 1.8.7 (2012-10-12 patchlevel 371) [i686-linux]
How to fix the env error for cron
?