Run ruby ​​script from cron

My script uses mysql, tiny_tds, fileutils and net / ftp. Running on a ruby ​​1.9.3. It works great when I run it from a folder.

However, when I add it to the cron tab, tiny_tds constantly fails. I don’t know if any of the other stones crashed because I cannot get this error:

require ': there is no such file to load - tiny_tds (LoadError)

I tried to execute it from the same shell that crontab used, and I get this error.

The whole script is just 1 file.

I am new to ruby, so my knowledge is limited in setting up the environment correctly.

In the file header I have

    #!/usr/bin/ruby
    require "mysql"
    require "fileutils";
    require "tiny_tds"  
    require "net/ftp"

In short, I get a list of tasks from mysql, compare it with the MsSQL, FTP files and update mysql again when the tasks are executed.

And I need to run this from cron.

, , , , , .

!

+5
2

, , , , . PATH, LD_LIBRARY_PATH , .

, : crontab -e

* * * * *  set > /tmp/setvals

. . crontab -e .

, /tmp/setvals , set . , cron.

+5

RVM cron, script, RVM - , #!/usr/bin/ruby - #!/path/to/rvm/wrappers/ruby-1.9.3-p392/ruby

script:

rvm alias create my_app 1.9.3

script ( ):

#!/path/to/rvm/wrappers/my_app/ruby
+2

All Articles