Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. # cron with rbenv
  2.  
  3. ## Check your environmental values
  4.  
  5. You use `rbenv` and create some ruby script and now set it to `cron`.
  6.  
  7. ```
  8. 43 19 * * * ruby your_ruby_script.rb
  9. ```
  10.  
  11. Later, you find it does not work while your `syslog` says that the job itself is propary triggered.
  12.  
  13. Then, it is most likely because of `cron` environmental value. Check this:
  14. ```
  15. crontab -e
  16.  
  17. 43 19 * * * ruby -v; /home/ubuntu/.rbenv/shims/ruby -v >> /tmp/ruby.type
  18. ```
  19.  
  20. In my case, the out put is:
  21. ```
  22. cat /tmp/ruby.type
  23. ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
  24. ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
  25. ```
  26.  
  27. The script was grabbing wrong ruby with wrong set of `gem`s.
  28. Correcting the ruby path soleved.
  29.  
  30. ```
  31. 43 19 * * * /home/ubuntu/.rbenv/shims/ruby your_ruby_script.rb
  32. ```
  33.  
  34. Cheers,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement