Crontab execute the command but the ruby script is not running?

Try: 12 10 * * * /bin/bash -c 'source /home/user/. Rvm/scripts/rvm && cd /home/user/path/ && /home/user/. Rvm/bin/ruby-1.9.2-p136 -rubygems script.rb.

2 Good answer. When you login to bash from a terminal it automatically runs some scripts to setup your environment (usually including the "rvm" ruby environment setup). "cron" just runs exactly what it finds in the cron file and does not automatically run any environment setup scripts.

– James Anderson Aug 8 at 6:35 thank you scuawn, Could you tell me what the source does? – Sayuj Aug 8 at 6:44 1 @Sayuj: That just runs all the usual rvm initialization stuff that you'd normally get with a login shell. – mu is too short Aug 8 at 7:03 Good answer.

Here is a full blog post on the subject: danielsz.posterous. Com/how-to-run-rvm-scripts-as-cron-jobs – Daniel Szmulewicz Aug 8 at 0:54.

If you are using . Rvmrc file in your project to setup ruby version for you project. Then you need to tell rvm to trust rvmrc file in ~/.

Rvmrc rvm_trust_rvmrcs_flag=1 this will disable prompt and your cron will not hang.

I've set a crontab for my ruby script. The command /bin/bash -c 'cd /home/user/path/ && /home/user/. Rvm/rubies/ruby-1.9.2-p136/bin/ruby -rubygems script.

Rb' runs well. But the script is not executing exactly. I'm not getting the expected out put from it.

What may be the cause of the issue?

If you are using . Rvmrc file in your project to setup ruby version for you project. Then you need to tell rvm to trust rvmrc file in ~/.rvmrc.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions