From: Michael Orlitzky <michael@orlitzky.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Postgres gem not found by cron job
Date: Wed, 11 Aug 2010 14:17:14 -0400 [thread overview]
Message-ID: <4C62E92A.80807@orlitzky.com> (raw)
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?
next reply other threads:[~2010-08-11 19:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 18:17 Michael Orlitzky [this message]
2010-08-11 19:16 ` [gentoo-user] Postgres gem not found by cron job Bill Longman
2010-08-11 19:32 ` Michael Orlitzky
2010-08-13 18:36 ` [gentoo-user] " Hans de Graaff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C62E92A.80807@orlitzky.com \
--to=michael@orlitzky.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox