Re: Query

From: <vince4friend-root_at_yahoo.com>
Date: Sun, 3 Sep 2006 09:08:16 -0700 (PDT)


Hi Satya & Marco,  

 Some additional ideas:  

 I'd remove the "-f" from the "#!/bin/sh -f": this is usually a "CSH" option to skip loading user's ".cshrc". I'm not sure what SH does with it: haven't seen anything about it in the man pages. For sure you don't use this "-f" when executing the script manually, so it's worth replicating what's working... Maybe you can just do the exact same command in your crontab and explicitly call SH:

     */2 * * * * /bin/sh /home/lab/MyScript.sh > /home/lab/RunLog.txt 2>&1  

 Maybe this depends on the OS. I'm used to Linux and Solaris. In both cases, even if the cron job is owned by the super user, each command will be executed with the rights and environments of each user. Basically each command is run through something like a "su userid -c ...". At least this is my understanding. If it was correct, this would mean the user's settings would have to be investigated more than the super user's ones.  

 Just 2 cents - Vince  

Hi Satya,

> /home/lab/MyScript.sh: line 3: root: command not found
>
>
> Note: when I am running MyScript.sh by
> [...]$sh MyScript.sh
> simple shell it works without error.

the cron job will work as a superuser, so you have to check if the superuser is able to run ROOT. In case it is not you should check if the ROOTPATH variable is set (since when you set the PATH it is only valid for normal user).

Regards,
Marco Calviani Received on Sun Sep 03 2006 - 18:08:29 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET