From owner-freebsd-questions@FreeBSD.ORG Thu Apr 24 20:26:30 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 CBE9C106566B for ; Thu, 24 Apr 2008 20:26:30 +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 862508FC1C for ; Thu, 24 Apr 2008 20:26:30 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: (qmail 77581 invoked by uid 89); 24 Apr 2008 20:26:28 -0000 Received: from unknown (HELO ?192.168.1.110?) (jalmberg@75.127.142.66) by mx1.identry.com with ESMTPA; 24 Apr 2008 20:26:28 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-questions@freebsd.org From: John Almberg Date: Thu, 24 Apr 2008 16:26:15 -0400 X-Mailer: Apple Mail (2.752.3) Subject: Cron question 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, 24 Apr 2008 20:26:30 -0000 I have recently switched from Linux to FreeBSD for my web server. Absolutely love it, but am having one difficulty that is driving me bats... I wouldn't think that cron would run differently on BSD than Linux, but it seemingly does. I have a user crontab that runs a PHP script once a day. This worked effortlessly on the old box. If I am logged in as the user (gs), I can run the script without problem just by typing the command line ./script.php, or /full/path/ to/script.php The trouble comes when I try to run this script with cron. I have something like this in the gs user crontab: SHELL=/usr/local/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ local/bin:/usr/X11R6/bin:/home/gs/bin HOME=/home/gs 0 15 * * * /home/gs/bin/script.php >>/home/gs/log/script.log I can see from the cron log that cron runs script.php at the appointed hour: Apr 24 15:00:03 on /usr/sbin/cron[72414]: (gs) CMD (/home/gs/bin/ script.php >>/home/gs/log/script.log) HOWEVER, absolutely nothing happens as a result. No error message in any /var/log file, and script.log is not even touched, even though the script is quite verbose and logs a bunch of stuff when it runs. It is as if the script was never run. I have looked at this every which way, but it doesn't make any sense to me. There are other scripts in the same crontab that run without problem. I have tried changing the crontab to: 0 15 * * * /usr/local/bin/php /home/gs/bin/script.php >>/home/gs/log/ script.log But that has no effect. So, the question is, how can a script that runs perfectly when executed by user gs from the command line, not work at all when run as user gs's crontab? Not even generate an error message or log entry? What is different in the user crontab runtime environment? Any insight much appreciated. Brgds: John [gs@on ~]$ uname -a FreeBSD on.identry.com 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #1: Mon Dec 3 09:46:53 EST 2007 root@on.identry.com:/usr/obj/usr/src/sys/ INET_ON amd64 [gs@on ~]$ which php /usr/local/bin/php