From owner-freebsd-questions@FreeBSD.ORG Thu Jul 17 11:44:37 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 0E4601065673 for ; Thu, 17 Jul 2008 11:44:36 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: from mx1.identry.com (on.identry.com [66.111.0.194]) by mx1.freebsd.org (Postfix) with ESMTP id 858D98FC21 for ; Thu, 17 Jul 2008 11:44:36 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: (qmail 45362 invoked by uid 89); 17 Jul 2008 11:44:35 -0000 Received: from unknown (HELO ?192.168.1.110?) (jalmberg@75.127.142.66) by mx1.identry.com with ESMTPA; 17 Jul 2008 11:44:35 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <487F1097.31417.718F23E@iwrtech.iwr.ru.ac.za> References: <487F1097.31417.718F23E@iwrtech.iwr.ru.ac.za> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6155B532-19E5-473C-9736-6C7BFBD3E1FE@identry.com> Content-Transfer-Encoding: 7bit X-Marketcircle-Dmi-Agent: <6155B532-19E5-473C-9736-6C7BFBD3E1FE@identry.com> From: John Almberg Date: Thu, 17 Jul 2008 07:44:33 -0400 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.752.3) 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: Thu, 17 Jul 2008 11:44:37 -0000 > > 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. > Yes, I finally figured this out. I had the problem completely backwards... I assumed that when I ran 'su user', I was logged in as the user. Since the command worked when I was 'logged in' and didn't work for crontab, I figured crontab must be different. It never occured to me that *I* was running in a different environment :-) If I had realized, a quick read of the su man page would have solved my problem. As it was, I had been shown su long ago by another admin, and just assumed I knew how it worked. Wrong! Well, that's the joys of being of newbie administrator... So little time, so many man pages to read! Thanks: John