Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crontab Environment

Status
Not open for further replies.

BikerGal

Programmer
Jul 12, 2002
17
0
0
GB
Sorry could not do a keyword search as it seems to be down at the minute. I am having more problems with the crontab jobs not running. I have run the script when logged on as root and it works but it does not run when as a crontab job. I thought that the environment the crontab jobs run under was the same as the root environment is this not correct?

thanks a lot
 
No, cron uses a minimal environment. You can source in the users' . profile in your job if you need their environment settings using the following line:

[tt]. /home/user/.profile[/tt]

You can also set a default PATH for cron jobs (under Solaris anyway) in /etc/default/cron.
Annihilannic.
 
What flavor?

SCO versions 5.0.4, 5.0.5, and 5.0.6 have problems that are addressed by a patch. Doesn't fix everything you can do wrong but does fix the built in problem. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
HI,

If you're still having problems then make sure your script commands secify full paths. i.e.

GREP=/usr/bin/grep
NAWK=/usr/bin/nawk
PS=/usr/bin/ps

RES=`$PS -ef|$GREP something|$NAWK '{print $2}`

I've had problems similar to this and even specifying full paths to scripts failed. I got round this by CD'ing into the directory prior to making the call. This was due to a poorly setup cron environment because I couldn't have root on certain boxes which were hosted by 3rd parties.


ART
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top