I feel like I should be able to solve this one, but it started after my
last world update so maybe someone else has had a similar problem.
We have a ruby script called 'mailshears' on our mail server that cleans
up orphaned users and domains every night. The main script,
includes a class,
which in turn requires the postgres library from ruby-postgres:
I don't think there's anything fancy going on here. All of the required
packages are installed, and the script runs fine when I execute it
manually. For example, both of the following work:
(That last one mimics my crontab.) The problem is, whenever the nightly
cron job runs, the 'postgres' library can't be found. I get mailed this
/root/src/mailshears/bin/../src/postfixadmin_db.rb:1:in `require': no
such file to load -- postgres (LoadError)
from /etc/cron.daily/01mailshears:35:in `require'
The path /etc/cron.daily/01mailshears is simply a symlink to
/root/src/mailshears/bin/mailshears, and of course, if I execute that
symlink manually, it runs fine.
What's different between my root environment and the one in which cron
runs (with respect to ruby and its gems)? Where should I start looking?
08-11-2010, 08:16 PM
Postgres gem not found by cron job
> What's different between my root environment and the one in which cron
> runs (with respect to ruby and its gems)? Where should I start looking?