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

[EMAIL PROTECTED] ~]$ uname -a
FreeBSD on.identry.com 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #1: Mon Dec 3 09:46:53 EST 2007 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/ INET_ON amd64

[EMAIL PROTECTED] ~]$ which php
/usr/local/bin/php


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to