I'm trying to get a ruby script run into a crontab and it keeps failing
saying it can't find my mechanize gem. When I run the script form the
command line, everything runs fine and I don't get any failures.
On Fri, Jun 5, 2009 at 3:48 PM, Matthew Lagace <mlagace@rasib.ca> wrote:
Hello,
I'm trying to get a ruby script run into a crontab and it keeps failing
saying it can't find my mechanize gem. When I run the script form the
command line, everything runs fine and I don't get any failures.
I'm trying to get a ruby script run into a crontab and it keeps failing
saying it can't find my mechanize gem. When I run the script form the
command line, everything runs fine and I don't get any failures.
Often and often when cron jobs fail it is because the environment variables
are not set. Cron jobs do not automatically execute .bashrc (or equivalent)
you generally need to create a script that calls your program after either
setting the environment by hand or doing eg ". .bashrc".
I'm trying to get a ruby script run into a crontab and it keeps failing
saying it can't find my mechanize gem. When I run the script form the
command line, everything runs fine and I don't get any failures.
Anyone ever had that problem before?
Oh yes.
Try getting it to run from the command line with a blank
environment with 'env -', e.g.,
% env - run_stuff.sh
Typically a crontab job runs with a much reduced environment.
Alternatively, stick a printenv in your crontab to see
what environment it is working with and compare to your
interactive environment.
You might also find crontab's sister command, 'at', helpful
to get tighter feedback cycles.
If I start by a human-written block of data, such as ITEMS below, is it possible to deserialize these into objects of type Item? How might this be done?
Hmm I've tried running with a blank environment and it fails with the
same error not finding the gems. I have set the ENV variables to the
proper directories and it is still giving me the same error. I'm not
sure what else to try although I appreciate all your recommendations!
Bil Kleb wrote:
···
Matthew Lagace wrote:
Hello,
Hi.
I'm trying to get a ruby script run into a crontab and it keeps failing
saying it can't find my mechanize gem. When I run the script form the
command line, everything runs fine and I don't get any failures.
Anyone ever had that problem before?
Oh yes.
Try getting it to run from the command line with a blank
environment with 'env -', e.g.,
% env - run_stuff.sh
Typically a crontab job runs with a much reduced environment.
Alternatively, stick a printenv in your crontab to see
what environment it is working with and compare to your
interactive environment.
You might also find crontab's sister command, 'at', helpful
to get tighter feedback cycles.
Set them *where*? You need to set them in your crontab directly,
*not* in your personal e.g. .bashrc.
···
On Fri, Jun 5, 2009 at 8:00 AM, Matthew Lagace<mlagace@rasib.ca> wrote:
Hmm I've tried running with a blank environment and it fails with the
same error not finding the gems. I have set the ENV variables to the
proper directories and it is still giving me the same error.
If I start by a human-written block of data, such as ITEMS below, is it possible to deserialize these into objects of type Item? How might this be done?
Easy, just yaml them to find out how the serialized form should look:
On Fri, Jun 5, 2009 at 8:00 AM, Matthew Lagace<mlagace@rasib.ca> wrote:
Hmm I've tried running with a blank environment and it fails with the
same error not finding the gems. I have set the ENV variables to the
proper directories and it is still giving me the same error.
Set them *where*? You need to set them in your crontab directly,
*not* in your personal e.g. .bashrc.
From (recent) experience here, I've had similar issues across
different versions of the same distro (CentOS/RedHat). The paths and
environment variables are drastically different. For me, I was
shelling out to lspci
Something along the lines of this would have been a valid fix.
Tried everything in here and same problem. What I've noticed though this
version of Ubuntu (Feisty Fawn 7.04) which I know is outdated messed up
all the paths for ruby and rubygems.
Shouldn't matter if you put in full paths to everything you reference.
···
On Fri, Jun 5, 2009 at 11:19 AM, Matthew Lagace<mlagace@rasib.ca> wrote:
Tried everything in here and same problem. What I've noticed though this
version of Ubuntu (Feisty Fawn 7.04) which I know is outdated messed up
all the paths for ruby and rubygems.
Tried everything in here and same problem. What I've noticed though this version of Ubuntu (Feisty Fawn 7.04) which I know is outdated messed up all the paths for ruby and rubygems.
Hassan, just a note, you don't need the "export" part of the line
Force of habit; in this example, no, but if a subsequent part of the
entry spawns a new shell, I think it's necessary.
I think. Will have to revisit that sometime, but not today
Hey, does this thread have anything to do with the Bourne-shell usage bias which first manifested itself for me in at last year? In other words, if you use a shell, any shell, in at you get sh, not bash, the former being considered lighter weight and perhaps somehow safer and more standard, but on the other hand breaks things like some commands you are used to in some syntax in Bash. For instance, you must do the following to export:
I honestly don't know, I've tried everything in here and I still can't
get it to work.
Hassan Schroeder wrote:
···
On Fri, Jun 5, 2009 at 11:19 AM, Matthew Lagace<mlagace@rasib.ca> wrote:
Tried everything in here and same problem. What I've noticed though this
version of Ubuntu (Feisty Fawn 7.04) which I know is outdated messed up
all the paths for ruby and rubygems.
Shouldn't matter if you put in full paths to everything you reference.