To date, it has become necessary to put the ruby ​​script on periodic execution
Heard about cron scheduler

I'm currently working 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:

Ruby installed via RVM
In the file ~/.bashprofile
source /etc/profile.d/rvm.sh

I’ll add crontab -e line to * * * * * ruby ​​/var/www/nw/x.rb

I’m getting to/var/www/syslog
(root) CMD(ruby /var/www/nw/x.rb)
Cron logs are not configured - the next line
(CRON) info(No MTA installed, discarding output)

Script actions are not executed

If you write ruby ​​x.rb in the console - the script works, but not su root ruby ​​x.rb - writes"ruby: no such file or directory"

How to solve this problem, what and where should I add?

3 Answers 3

in your version there is an interpreter and then the command
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.
still check the permissions so that the script can run.
and configure mta, even though nullmailer, so that the system logs are sent to the mail.

man cron:
#m h dom mon dow user command
0 23 * * * root/bin/bash /full/path/to/my/script.sh
You need the full path to the interpreter, for example
* * * * * /home/user/.rbenv/versions/2.1.0/bin/ruby /home/user/scripts/shoot_my_leg.rb

in your case, instead of .rbenv, you need to put an interpreter from the .rvm folder
Look at Using RVM with Cron
And whenever heme your task will not solve? Very handy thing, as for me.