From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OjGdG-0003FU-6f for garchives@archives.gentoo.org; Wed, 11 Aug 2010 19:06:34 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C6BEEE0A6F for ; Wed, 11 Aug 2010 19:06:33 +0000 (UTC) Received: from mail2.viabit.com (mail2.viabit.com [65.246.80.16]) by pigeon.gentoo.org (Postfix) with ESMTP id 94A0DE0A81 for ; Wed, 11 Aug 2010 18:17:18 +0000 (UTC) Received: from [10.1.1.204] (unknown [65.213.236.244]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 52896D8D2B for ; Wed, 11 Aug 2010 14:17:18 -0400 (EDT) Message-ID: <4C62E92A.80807@orlitzky.com> Date: Wed, 11 Aug 2010 14:17:14 -0400 From: Michael Orlitzky User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: [gentoo-user] Postgres gem not found by cron job Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: 836f7c74-be50-48f5-86d6-9b3338282ee6 X-Archives-Hash: 0a4c7b4d4bcbd6d872bacc58cd4f20a2 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?