From owner-freebsd-questions@FreeBSD.ORG Tue Oct 25 22:27:44 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C95AE16A41F for ; Tue, 25 Oct 2005 22:27:44 +0000 (GMT) (envelope-from dan@dpcsys.com) Received: from ns.beach.net (ns.beach.net [12.130.64.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71E7443D46 for ; Tue, 25 Oct 2005 22:27:44 +0000 (GMT) (envelope-from dan@dpcsys.com) Received: from [148.64.213.203] (misc-148-64-213-203.pool.starband.net [148.64.213.203]) by ns.beach.net (8.12.9/8.11.3) with ESMTP id j9PMR4lv040325; Tue, 25 Oct 2005 15:27:08 -0700 (PDT) (envelope-from dan@dpcsys.com) In-Reply-To: <20051025181832.GA61086@xor.obsecurity.org> References: <20051025131352.217826@bob> <20051025181832.GA61086@xor.obsecurity.org> Mime-Version: 1.0 (Apple Message framework v734) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Dan Busarow Date: Tue, 25 Oct 2005 16:27:26 -0600 To: Robert Wall X-Mailer: Apple Mail (2.734) Cc: freebsd-questions@freebsd.org Subject: Re: Crontab and GPG? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2005 22:27:44 -0000 On Oct 25, 2005, at 12:18 PM, Kris Kennaway wrote: > On Tue, Oct 25, 2005 at 01:13:52PM -0500, Robert Wall wrote: > >> Hello! I'm attempting to run GPG from cron, and it's not >> working. I can run the script from the command line, and all >> works perfectly. When I try to run it from cron, however, it >> doesn't work. The crontab calls this script, called "pgpdecrypt" >> with the following crontab line: >> >> */1 * * * * root /bin/bash /etc/ >> pgpdecrypt >> >> The /bin/bash wasn't originally there; I added it to make sure >> that the script was using the correct shell. Still no luck. >> Here's the script that it calls: >> >> echo >> /etc/pgpdecrypt.logger "PGP Decrypter Starting" >> cd /home/folder >> for filename in `ls *pgp` >> do >> gpg --batch --no-tty --passphrase-fd 0 --output /home/folder/pgp- >> decrypted/$filename.txt --decrypt /home/folder/$filename < /home/ >> folder/pp >> /home/folder/pgp-decrypted/import.pl /home/folder/pgp-decrypted/ >> $filename.txt >> echo >> /etc/pgpdecrypt.logger "/home/folder/$filename /home/ >> folder/pgp-original/$filename" >> done >> >> The output file is cheerfully logging the filenames >> appropriately. /var/log/messages doesn't contain any errors. >> Anybody got any ideas? Even if I could get a competent logging >> mechanism in place to see why GPG doesn't feel like running, that >> would be great. >> > > You're assuming gpg is in PATH, which it probably isn't. crontab > errors aren't logged in /var/log/messages anyway (they're mailed to > you) - see the manpages. In addition to PATH you will also need to verify that LOGNAME and HOME are set in the script. Dan