OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: sh script from cron

From: Jason Opperisano (opie817west.com)
Date: Wed Dec 01 2004 - 14:31:14 CST


On Wed, Dec 01, 2004 at 02:15:13PM -0500, Roy Morris wrote:
> I have a neat error. I wrote a small script (see below) that checks my
> website. if I run the script manually it works fine. but if I run it from
> roots cron, it does not work as expected. The first part about default if we
> can't reach the site fails. Any ideas? Try running this and you will
> see!!
>
> Here is my cron entry.
> */1 * * * * /bin/sh /home/rmorris/fh.sh
>
> Here is what I get in my log, if I run it from the console.
> # /bin/sh fh.sh
> # tail /tmp/sysmon.log
> Wed Dec 1 14:09:39 EST 2004 - Checking www.finalhour.ca, the return value was
> 200
>
>
> when I run from cron I get this.
> Wed Dec 1 14:11:01 EST 2004 - Checking www.finalhour.ca, the return value
> was
> ** CRITICAL ** No Access to Finalhour.ca
>
> Am I nuts? or am I missing something very simple here!

does adding:

  PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin

to the top of your script fix it?

-j

--
"Oh, people can come up with statistics to prove anything, Kent. 14%
 of people know that."
        --The Simpsons