Inheriting proper env for crontab




When I login as 'scott' , I can successfully execute a shell-script
which calls 'sqlplus' command from it. But I am unable to execute it
as cron job because sqlplus does not execute properly.

I logged in as 'scott', and added the following line to crontab :
5 * * * * full_path/my_cmd param1 param2
But it does not work.
I get the error : ORA-07217 : sltln: environemnt variable cannot be
evaluated.

So I modified crontab entry to :
5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2
This generates the error : su : Sorry.
Presumably it expects the user's (scott's) password to be supplied.

So I logged in as root and added an entry to crontab :
5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2
This has better success but when I executes my_cmd, it does not find
the command sqlplus because sqlplus is not in its PATH .

So I logged in as root and added an entry to crontab :
5 * * * * /usr/bin/su scott -c full_path/interm_script

Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/
bin
This has better success because sqlplus is now in its PATH . But I
still get the error :
Message file sp1<lang>.msb not found.
Error 6 initializing SQL*Plus.

Ideally I would like to manipulate just my own crontab, instead of the
root's crontab. But even if the root can set up a proper cronjob, I
will be happy.

Please advise. Thanks in advance.

.



Relevant Pages

  • Inheriting proper env for crontab
    ... I can successfully execute a shell-script ... as cron job because sqlplus does not execute properly. ... and added the following line to crontab: ... the command sqlplus because sqlplus is not in its PATH. ...
    (comp.unix.shell)
  • Re: Inheriting proper env for crontab
    ... as cron job because sqlplus does not execute properly. ... and added the following line to crontab: ... the command sqlplus because sqlplus is not in its PATH. ...
    (comp.unix.shell)
  • Re: Inheriting proper env for crontab
    ... as cron job because sqlplus does not execute properly. ... and added the following line to crontab: ... the command sqlplus because sqlplus is not in its PATH. ...
    (comp.unix.shell)
  • Re: Inheriting proper env for crontab
    ... This has better success because sqlplus is now in its PATH. ... Message file sp1.msb not found. ... in a crontab line might be crucial to achieving this. ...
    (comp.unix.shell)
  • Re: Run a PL SQL Package from a shell script
    ... I was successful in executing a shell script that displays records of a ... I want to execute a PL SQL package. ... "execute Package.Procedure" | sqlplus username/password@database ...
    (comp.unix.shell)