Date: Thu, 24 Apr 2008 16:26:15 -0400 From: John Almberg <jalmberg@identry.com> To: freebsd-questions@freebsd.org Subject: Cron question Message-ID: <C615711F-BD11-4AAE-8321-5A93A64863E6@identry.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C615711F-BD11-4AAE-8321-5A93A64863E6>