Sandy Knight wrote:

I am having trouble configuring my shell scripts to run under
cron (user level, not root). I have set up a test.sh script which
sends me an email, it works fine from the command line (ssh). the script is as follows:

#!/bin/sh
echo "helloworld" | mail -s "helloworld" [EMAIL PROTECTED]
php /home/a_user/cron/test.php


As you can see I am also trying to get a php script to run (this is my ultimate aim).

My crontab is as follows:

# /home/a_user
#
SHELL=/bin/sh
PATH=/home/a_user/cron
HOME=/home/a_user
#
#
#minute hour    mday    month   wday    command
#
#
*/5 * * * *   /home/a_user/cron/test.sh


I have done the following:

$ pwd

/home/a_user

$ crontab cron/myCronTab

$ crontab -l

{output - see above}


Crontab is trying to run my script as I receive an email every 5 minutes saying:

/home/a_user/cron/test.sh: not found


The permissions for the scripts are:

$ ls -lt cron/

-rw-r--r--  1 a_user  vusers   322 Sep  9 12:27 myCronTab
-rwxr-xr-x  1 a_user  vusers   107 Sep  9 12:16 test.sh
-rwxr-xr-x  1 a_user  vusers    99 Sep  4 17:58 test.php

Thank you in advance,

Sandy



For starters, assume cron to be totally ignorant about
paths.  That means it doesn't know "whereis" anything,
etc.  Hard-code things, IOW.

That said, and I may be a bit confused, but why try
to supersede whatever limited environment cron
may already have by setting more env vars?

Specifically in this case, try using a crontab with
no env vars set (specifically) and hard code all the paths.
Simply run "crontab -e" and put /usr/local/bin/php -q /path/to/my/script.php
there and see what happens.

HTH,

Kevin Kinsey
_______________________________________________
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