g_f wrote:
> Like Tim said, it's probably something in the environment. Besides
> PATH, you could have other environment variables set in your BASH
> startup that are not set when the default /bin/sh gets started.
> 
> For apps I have to run from cron, if I need to, I'll write a
> wrapping .sh script that sets up the environment exactly as I need it.
> That could include switching to bash/csh/zsh or whatever, or
> sourcing .login or .profile or manually setting variables. Cron is
> stupid and does exactly what is said plus whatever (hidden) defaults
> the system has set up, so figuring it out can be a real task.
> 
> I wonder if you might have installed some libraries in your own space
> instead of the system's Ruby space. User permission problems will crop
> up then and can be a pain to figure out. I'd debug that by logging in
> as whatever user the cron job runs as, then manually run the script.
> 
> You don't say whether your job is running out of your own user's cron,
> or out of root's cron, or via the system's /etc/crontab. For my
> production code I set up the scripts to be run as root, but that's
> because I've been doing this so long I've shot off most of my toes and
> learned the hard lessons about what not to do... I'm sufficiently
> paranoid so I'm considered a trusted user. :-)

sorry for the silence, I've been swamped today (consultants are here 
doing a networking hardware upgrade).  However, I was incorrent in that 
'/.*/.match("myrandomstring")' does actually return a match when run 
from cron, but my actual regex is a bit more complicated.  My actual 
regex does match when run manually though.

I think I'm going to do a little more testing and cut some parts out of 
the regex to find if maybe there is just a single unit of the expression 
that is the problem.  It's a tedious pain in the rump, though since it 
matches when run manually, I have to make a change, check the time, set 
it to run in a minute from cron, wait for it to run, check the output 
file... very tedious and time-consuming.

This is run by root's cron by the way.  I don't how to do "sourcing 
.login or .profile" but I did try making a wrapper script with a 
/bin/bash hashbang that then just calls the ruby script, and that didn't 
make any difference.
-- 
Posted via http://www.ruby-forum.com/.