public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Postgres gem not found by cron job
@ 2010-08-11 18:17 Michael Orlitzky
  2010-08-11 19:16 ` Bill Longman
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Orlitzky @ 2010-08-11 18:17 UTC (permalink / raw
  To: gentoo-user

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,

   /root/src/mailshears/bin/mailshears

includes a class,

   require 'src/postfixadmin_db'

which in turn requires the postgres library from ruby-postgres:

   require '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:

   cd /root/src/mailshears/bin/
   ./mailshears

   cd /
   export PATH=/sbin:/bin:/usr/sbin:/usr/bin
   export HOME=/
   /root/src/mailshears/bin/mailshears

(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 
every night:

   /root/src/mailshears/bin/../src/postfixadmin_db.rb:1:in `require': no
   such file to load -- postgres (LoadError)
	from /root/src/mailshears/bin/../src/postfixadmin_db.rb:1
	from /etc/cron.daily/01mailshears:35:in `require'
	from /etc/cron.daily/01mailshears:35

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?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-13 19:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-11 18:17 [gentoo-user] Postgres gem not found by cron job Michael Orlitzky
2010-08-11 19:16 ` Bill Longman
2010-08-11 19:32   ` Michael Orlitzky
2010-08-13 18:36     ` [gentoo-user] " Hans de Graaff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox