LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Crontab "root user" problems... (https://www.linuxquestions.org/questions/linux-general-1/crontab-root-user-problems-236491/)

Clubber Lang 09-28-2004 11:47 PM

Crontab "root user" problems...
 
I have posted this question on the Newbie Forum with no responses, so I thought I would also start a copy here to get wider visability for it:

-------------------------------------------------------

I have a question regarding CRON. I currently have a Windows 2000 system with CYGWIN installed. CRON is working on the system and is able to run basic commands and Shell Scripts. However, I have a semi-large Bash Shell Script that runs several TCL/TK scripts and Windows applications. When I run the Shell Script with CRON I am failing to see any of the output files created by my TCL scripts and Windows Applications. When I run the Shell Script manually from CYGWIN it runs perfect.

Here is the line I have in my CRONTAB:

0 11 * * * . /tmp/NiteBld.sh

After reading other sites, it looks like I might have a problem with the environment variables CRON is using, which differ to what CYGWIN might have setup. Is there a way I can mirror my normal environment variables to CRON?

Also, I have read that I might be running into a file permissions problem. I have CHMOD all of the folders that will have output logs written to, but with no luck.

Please let me know if you would like to view the Shell Script. However, I know that the Shell Script is correct when run manually.

Any information I could get on this would be GREATLY appreciated.

Thanks a bunch,

Clubber Lang

-------------------------------------------------------

PS.

I have been reading through some of the other threads on this forum. My problem seems to be very similar to another one in the Newbie Forum.

In bjdea1's final response he stated the following:

quote:
--------------------------------------------------------------------------------
sorry I found the cause. I have the main config file being accessed as "./config.file". No wonder everything else is failing because this config file is not being read at the very start of the program. Sorry I should have checked this more, thanks for your help.
--------------------------------------------------------------------------------



Since I am new this this, how is he accessing this config file? I do not have a /var/spool/cron directory. When I type the "su" command it reads: "su: user root does not exist". I also do not have a file in the /etc/crond.daily/ directory like wolf2554 mentions. It seems this is a very simple problem. I just don't know how to fix it...

sjspig 09-29-2004 12:25 PM

If it is an environment issue set up environment variables using the environment name = value syntax in the crontab.

Something like this in the crontab sets up the environment:

ENVVAR=VALUE - sometimes this has to have spaces between the '=' sign on both sides but it depends on the cron implmentation.

Also, are you trying to run a job that is local to your current directory? You must specify the full path of the cron job. I just suggest this as the path to the script looked like:

./tmp/NiteBld.sh to me - the '.' actually looks separate in your post but it looks fishy to me as the . is not a command that I know of so I figured it had something to do with the path.

Clubber Lang 09-29-2004 07:06 PM

Thank you for the response. So if the environement variables I set in NiteBld.sh are:

export ICTSMODE=DEVELOPER
export ICTSMODE=DEVELOPER
export IPMI=1.50
export ICTSSHELL=wish83
export FTFSHELL=$ICTSSHELL
export ICTSROOT=ftf

Do I need to put the 5 cron time values in front of each of the exports (Ex: * * * * *) or just the environment variables as themself? When you launch Cygwin you usually already have lots of environment variables setup up. Do you have to move all of those over manually as well to Cron?

Clubber Lang

P.S. There should have been no space between the . and / in the earlier post. Typo. Sorry about that...

sjspig 09-30-2004 09:29 AM

The environment variables are on lines by themselves - no time specifications - just "VAR=VALUE" with a possible space required between the var and value. The ./ is problematic because the full path is usually required in order for cron to run the job correctly - even $HOME/command is more likely what you would want there. If the ./tmp folder is local to your user, then you would use something like $HOME/tmp/command...


All times are GMT -5. The time now is 01:32 AM.