From owner-freebsd-questions@FreeBSD.ORG Wed Jan 17 04:41:16 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A23316A492 for ; Wed, 17 Jan 2007 04:41:16 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from ayn.mi.celestial.com (hayek.celestial.com [192.136.111.12]) by mx1.freebsd.org (Postfix) with ESMTP id 4C10813C478 for ; Wed, 17 Jan 2007 04:41:16 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from localhost (localhost [127.0.0.1]) by ayn.mi.celestial.com (Postfix) with ESMTP id 6AB7E68604C9E; Tue, 16 Jan 2007 20:44:32 -0800 (PST) X-Virus-Scanned: amavisd-new at mi.celestial.com Received: from ayn.mi.celestial.com ([127.0.0.1]) by localhost (ayn.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yDWrn-UEUTqS; Tue, 16 Jan 2007 20:44:32 -0800 (PST) Received: by ayn.mi.celestial.com (Postfix, from userid 203) id 4EA4768604C99; Tue, 16 Jan 2007 20:44:32 -0800 (PST) Date: Tue, 16 Jan 2007 20:44:32 -0800 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20070117044432.GA23506@ayn.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <01fe01c739e8$080ca1f0$0300020a@mickey> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01fe01c739e8$080ca1f0$0300020a@mickey> User-Agent: Mutt/1.5.11 OpenPKG/2.5 Subject: Re: CRON Script not working right. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 04:41:16 -0000 On Tue, Jan 16, 2007, Don O'Neil wrote: >Anybody have any clues why a shell script run from root's CRON would act >differently then when run directly from the command line? Most often this is because the environment in the cron job is different, either missing variables or having variables that aren't set to a reasonable value (e.g. TERM). The way I usually figure something like this out is to dump the envioronment from the cron job, then do the same thing from the command line, then compare the two. #!/bin/sh # this is the cron job env | sort > /tmp/env.cron exit; Now from the command line ``env | sort > /tmp/cron.cli''. Now run something like ``diff -u /tmp/env.cron /tmp/cron.cli'' to see what is different. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 When a place gets crowded enough to require ID's, social collapse is not far away. It is time to go elsewhere. The best thing about space travel is that it made it possible to go elsewhere. -- Robert Heinlein