Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
HI
I have a number of scripts (run in ksh)that run and execute some import procedures for an Oracle database. To update the users I have created a status screen that updates as the scripts progress. To do this I am using a global function which I specify the location of using the .profile and .kshrc. All users are using the korn shell and this works OK during interactive execution.I run the scripts overnuight using CRON but obviously CRON has a minimal environment set and I get errors. Anyone know how to get CRON to run the /$HOME/.profile and therefore provide the location of my global function? I have tried putting /$HOME/.profile at the begining of my scripts, but this does not seem top work.
Thanks for any help!

I don't think you mean /$HOME/scriptname - root's $HOME is often "/" (so /$HOME would be "//"). If root's shell is ksh or bash (or in Solaris, /usr/xpg4/bin/sh) you could use ~someuser/scriptname. Otherwise you have to hardcode the path.
When calling scripts from cron, explicitly source any environment scripts, e.g:
. /fully/qualified/path/oracle_envs param1 param2
${somevar}/do_stuff

Thanks William, but I am running the script as a user other than root. I understand that CRON runs a subshell within the user's /$HOME/ but will not pick up anything but the basic environment.
In effect I want the .profile to have run so that the ksh script finds the function.
Thanks
Phil.

Thanks William!
The . $HOME/.profile did the trick, but I had to add the shell to it to make it work:
SHELL=/usr/bin/ksh; export SHELL; . $HOME/.profile;
My global ksh function now works!!

![]() |
i need help about sed in ...
|
how to calculate date (ur...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |