From owner-freebsd-questions@FreeBSD.ORG Wed Jul 16 15:38:13 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD58106566C for ; Wed, 16 Jul 2008 15:38:13 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id B10928FC1E for ; Wed, 16 Jul 2008 15:38:13 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id 8D69AEBC09; Wed, 16 Jul 2008 11:38:12 -0400 (EDT) Date: Wed, 16 Jul 2008 11:37:18 -0400 From: Bill Moran To: John Almberg Message-Id: <20080716113718.b165f10c.wmoran@potentialtech.com> In-Reply-To: <3BC71C1E-DD8B-4FD9-870A-A2D385E556C8@identry.com> References: <3BC71C1E-DD8B-4FD9-870A-A2D385E556C8@identry.com> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: how to simulate a user's crontab? 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: Wed, 16 Jul 2008 15:38:13 -0000 In response to John Almberg : > I often run into permission problems with user crontabs. That is, a > crontab run under a user's permissions. > > First of all, it seems to me that a user's crontab doesn't have > exactly the same permission as the user himself. Is this true? The crontab runs as the user, and thus has the exact same permissions. > Is there anyway I can simulate these permissions on the command line, > so I can test things before putting them in a crontab? > > What I'd like to avoid is the frustrating cycle of putting a line in > a user's crontab (a few minutes ahead), waiting for it to fire off, > have it fail, check error logs, try again... > > It would be much simpler if I could simulate the crontab's > environment, and just run the thing from the command line. > > Any hope? I'm running FreeBSD 6.3 I'm guessing you're having problems with environment settings, although the vagaries of the question don't give me much to go on (something along the lines of, "when I try to do x in cron, I get the error y; but it works fine when the user runs it outside of cron" would be more informative.) Write a cron job to dump the cron environment via echo, you can then set those environment variables when testing your scripts. -- Bill Moran http://www.potentialtech.com