[OpenIndiana-discuss] command will not run from cron but will from CLI

James Carlson carlsonj at workingcode.com
Mon May 9 19:06:30 UTC 2016


On 05/09/16 15:01, david at kosmosisland.com wrote:
> I have not been able to get even a simple command to run from cron.  For a
> test I created this script:
> 
> #!/bin/sh
> 
> export PATH="/usr/bin:/usr/sbin:/root"
> /bin/echo "test" > /root/test.log
> 
> It runs from the command line but does not from cron:
> 
> 55 11 9 * * * /root/test
> 
> The log shows:
> 
>>  CMD: * /root/test
>>  root 17987 c Mon May  9 11:55:00 2016
> <  root 17987 c Mon May  9 11:55:00 2016 rc=127
> 
> Also see:
> # ls -l /root/test
> -rwxr-xr-x   1 root     root          85 May  9 11:57 /root/test
> 
> 
> Looks like it cannot fork but /bin/sh, /bin/echo and /root/test all work
> from the command line.  What am I missing?

At a guess, it's saying "PATH=/usr/bin:/usr/sbin:/root: is not an
identifier".

Try either:

PATH=/usr/bin:/usr/sbin:/root
export PATH

or:

#!/bin/ksh

-- 
James Carlson         42.703N 71.076W         <carlsonj at workingcode.com>



More information about the openindiana-discuss mailing list