Jingqiang Zhang
2012-Aug-30 13:33 UTC
[Whenever gem]What is the reason that linux''s cron can''t automatic running?
OS : Ubuntu 12.04 Now I use Backup <https://github.com/meskyanichi/backup> and Whenever<https://github.com/javan/whenever> gem to backup my database. When I run backup perform -t my_backup ,I can works. But when I check the task crontab -l ,it as this: 0 22 * * * /bin/bash -l -c ''backup perform -t my_backup'' Run cat /etc/crontab to check my cron configuration file,it''s: SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin It''s different between */bin/bash* and /bin/sh ,how to do? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/1vEZmtjazLMJ. For more options, visit https://groups.google.com/groups/opt_out.
Matt Jones
2012-Sep-02 15:56 UTC
Re: [Whenever gem]What is the reason that linux''s cron can''t automatic running?
On Thursday, 30 August 2012 09:33:41 UTC-4, zhangjingqiang wrote:> > OS : Ubuntu 12.04 > > Now I use Backup <https://github.com/meskyanichi/backup> and Whenever<https://github.com/javan/whenever> gem > to backup my database. > When I run backup perform -t my_backup ,I can works. > But when I check the task crontab -l ,it as this: > > 0 22 * * * /bin/bash -l -c ''backup perform -t my_backup'' > > Run cat /etc/crontab to check my cron configuration file,it''s: > > SHELL=/bin/sh > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > > It''s different between */bin/bash* and /bin/sh ,how to do? >Cron runs commands with a very limited environment - PATH, for instance, may be missing things that it would have in your normal login shell. It''s typically a good idea to put an explicit path to any executable needed - so /some/path/to/backup instead of just backup. Digging around in the code for ''backup'' also shows that you may want to pass --root-path=/wherever/your/app/lives to the script as well, to ensure that it can find the config files, etc that it needs. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aqgNvWZ4-4AJ. For more options, visit https://groups.google.com/groups/opt_out.