problem with cron and rvm

N

nephish

Hey all,

I did an rvm install on an ubuntu server. I have a lot of ruby scripts
that i need to run from cron but cannot seem to get them to work
correctly.
It complains about missing gems, etc.. seems as though it is not
loading the environment correctly. If i run the same script from the
command line, all is ok.
Anyone know how to get cron to play nice with rvm? Been all over
google about it, all the articles i could find did not really explain
to me how to get cron to use rvm.

thanks for any tips.
-shawn
 
R

Robert Klemme

I did an rvm install on an ubuntu server. I have a lot of ruby scripts
that i need to run from cron but cannot seem to get them to work
correctly.
It complains about missing gems, etc.. seems as though it is not
loading the environment correctly. If i run the same script from the
command line, all is ok.
Anyone know how to get cron to play nice with rvm? Been all over
google about it, all the articles i could find did not really explain
to me how to get cron to use rvm.

You better look for documentation specific to cron. Cron sets up his
own environment so the simplest thing you can do is write a wrapper
shell script which sets all necessary variables the same way as they are
set in your login shell and then executes Ruby programs. Example

#!/bin/sh -fe

FOO=bar
PATH="abc:${PATH}"
# more vars...
export FOO PATH # ...

exec "$@"


Kind regards

robert
 
N

nephish

You better look for documentation specific to cron.  Cron sets up his
own environment so the simplest thing you can do is write a wrapper
shell script which sets all necessary variables the same way as they are
set in your login shell and then executes Ruby programs.  Example

#!/bin/sh -fe

FOO=bar
PATH="abc:${PATH}"
# more vars...
export FOO PATH # ...

exec "$@"

Kind regards

        robert

ok, very cool, thanks
sk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top