From owner-freebsd-questions@FreeBSD.ORG Thu Jul 17 07:27:54 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 9CFA21065670 for ; Thu, 17 Jul 2008 07:27:54 +0000 (UTC) (envelope-from iwrTech@iwr.ru.ac.za) Received: from f.mail.ru.ac.za (f.mail.ru.ac.za [IPv6:2001:4200:1010::25:6]) by mx1.freebsd.org (Postfix) with ESMTP id D492A8FC1D for ; Thu, 17 Jul 2008 07:27:53 +0000 (UTC) (envelope-from iwrTech@iwr.ru.ac.za) Received: from iwr.ru.ac.za ([146.231.64.249]:59450) by f.mail.ru.ac.za with esmtp (Exim 4.68 (FreeBSD)) (envelope-from ) id 1KJNu3-000F4x-Hr for freebsd-questions@freebsd.org; Thu, 17 Jul 2008 09:27:51 +0200 Received: from iwr61.iwr.ru.ac.za ([146.231.64.161]) by iwr.ru.ac.za with esmtp (Exim 4.69 (FreeBSD)) (envelope-from ) id 1KJNu3-000Kj7-HF for freebsd-questions@freebsd.org; Thu, 17 Jul 2008 09:27:51 +0200 From: "DA Forsyth" Organization: IWR To: freebsd-questions@freebsd.org Date: Thu, 17 Jul 2008 09:27:51 +0200 MIME-Version: 1.0 Message-ID: <487F1097.31417.718F23E@iwrtech.iwr.ru.ac.za> Priority: normal X-mailer: Pegasus Mail for Windows (4.41) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: f.mail.ru.ac.za (146.231.129.38) Subject: re: how to simulate a user's crontab? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: iwrTech@iwr.ru.ac.za List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2008 07:27:54 -0000 > Date: Wed, 16 Jul 2008 11:26:19 -0400 > From: 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? > If so, what permissions does a user's crontab have? > 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 John, it is not a permissions issue, but rather a path issue. Do as the other poster suggested and run a cron job to dump the environment and you will see that the PATH inside a cron job is very rudimentary. Either add what you need to it in the crontab or cron job, or always use absolute paths for everything in a cron entry. alternatively, set up an AT job as the user, then find the script generated by at and grab a copy (/var/spool/cron ???). You can use that copy as the basis for all cron scripts for that user, and always have the 'user' environment set up correctly. -- DA Fo rsyth Network Supervisor Principal Technical Officer -- Institute for Water Research http://www.ru.ac.za/institutes/iwr/