Answer the question
In order to leave comments, you need to log in
How to setup cron for ruby script?
Hello
At the moment there was a need to put the ruby script on periodic execution
Heard about the cron scheduler
Now I work as root,
PATH variable
/usr/local/rvm/gems/ruby-2.0.0-p353/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-2.0.0-p353/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/postgresql/9.3/bin:/usr/local/rvm/bin:
source /etc/profile.d/rvm.sh
* * * * * ruby /var/www/nw/x.rb
(root) CMD (ruby /var/www/nw/x.rb)
(CRON) info (No MTA installed, discarding output)
Answer the question
In order to leave comments, you need to log in
And gem Whenever will not solve your problem? A very handy thing, in my opinion.
You need the full path to the interpreter, for example
in your case, .rbenv
you need to put the interpreter from the .rvm
folder instead.
Look at Using RVM with Cron
in your version, there is an interpreter and then the command
and it takes time, then the user (if the system /etc/crontab) then the full path to the interpreter and the argument to it the full path to the desired script.
also check the permissions so that the script can be executed.
and configure mta, at least nullmailer, so that system operation logs are sent to mail.
man cron:
# mh dom mon dow user command
0 23 * * * root /bin/bash /full/path/to/my/script.sh
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question