0

I hope somebody can help me with the following.

I need my Raspberry to run a ruby script on startup which uses ruby's eventmachine package. I've installed rvm, the correct ruby version (2.1.0-dev), and all necessary packages.

If I start the script manually (using a startup.sh that calls the ruby script), all runs well.

However, when the script is called from crontab (using @reboot), it gives the error message (in an output file) that it cannot load the eventmachine file.

If I then log on to raspberry and run the script again (without doing anything else in between), everything works fine. It seems as if the script starts before rvm is properly set up, but this doesn't happen only at shell login, does it?

I'm calling ruby with an absolute path /home/pi/.rvm/rubies/ruby-2.1.0-dev/bin/ruby, so that also can't be it.

Any help would be greatly appreciated.

1 Answer 1

0

did you try to run the script from rc.local? It is useful and easier than cron for only running scripts at startup.

Documentation: https://www.raspberrypi.org/documentation/linux/usage/rc-local.md

Short example (but for Python): https://youtu.be/3_HGUlcA4gQ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.