bash - Setting path for whenever in cron so it can find ruby -


my ruby in /usr/local/bin. whenever can't find it, , setting path @ top of cron file doesn't work either, think because whenever running command inside of new bash instance.

 # not work path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin  # begin whenever generated tasks for: foo 0 * * * * /bin/bash -l -c 'cd /srv/foo/releases/20110429110637 && script/rails runner -e production '\''activerecord::sessionstore::session.destroy_recent(15)'\'''  # end whenever generated tasks for: foo 

how can tell whenever ruby binary is? making symbolic link /usr/bin seems messy me, guess might option.

this question offers env :path, "..." in schedule.rb solution, (a) can't find documentation of feature anywhere in docs (b) doesn't seem have solved asker's problem (unfortunately takes non-trivial turnaround time me try it). update it in bottom of page, i'll try now.

more info

  1. i can't modify cron command because it's generated whenever
  2. i verified if make new bash shell bash -l, /usr/bin/env finds ruby fine
  3. i tried exact command in cron, starting /bin/bash, command line of user, , worked.

so, mysterious...

the solution put in schedule.rb:

env :path, env['path'] 

here's little guide put on topic.


Comments