Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: oraenv and cron
In article <8qvpgh$7mc$1_at_nnrp1.deja.com>, oratune_at_aol.com wrote:
[edit]
> > > > Why is it that if I run a shell script containing oraenv from cron
> > > > as the
> > > > oracle user, it doesn't work; but if I have root run it in cron
> > > > with su - oracle -c script_name, it runs?
> >
[edit]
> cron does not invoke any shell startup features, such
> as .profile, .bash_profile. .login, .cshrc, etc., so all the cron job
> has as far as environment is the default /etc/profile settings. Since
> you are running an interactive .profile you will want to create a
> version of that, possibly named .cron_profile, that you can invoke from
> cron jobs without the interactive components. Yes, this will
> necessitate multiple .cron_profile files (to deal with the multiple
> SID's) or you'll need to make the .cron_profile as universal as
> possible and set the ORACLE_SID value in each cron job.
>
> When you run as root and invoke "su - oracle -c ..." you set the
> environment for oracle without the interactive commands; the "su -
> oracle" does this. Unfortunately cron does not work in this manner and
> you must set the environment in the scripts.
Not to beat a dead horse, but isn't oraenv supposed to do that very thing? It sets $PATH; it sets $ORACLE_SID; it sets $ORACLE_HOME. Or at least it does when not run from cron. What is there about a generic, no-.profile, cron environment that prevents oraenv from doing its job?
>
> --
> David Fitzjarrell
> Oracle Certified DBA
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
-- Joseph Thvedt jthvedt_at_my-deja.com Sent via Deja.com http://www.deja.com/ Before you buy.Received on Thu Sep 28 2000 - 16:35:12 CDT
![]() |
![]() |