Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Cronjob misbehaving
Simon --
One of the things that many people (even some of the more experienced unix types) tend to forget is that cron doesn't source the user's profile. This is why a script might work just fine from the prompt, but fail when submitted through cron.
So, the solution would be either:
Simon Waibale wrote:
>
> Hi all,
> Thanx for all the good work U R doing for Oracle.
> I have a misbehaving cronjob
>
> -------------Cron Entry
> 0 5 * * * /usr/scripts/recompile.sh > /ops/scripts/recompile.log 2>&1
>
> -------------recompile.sh
> #!/bin/ksh
>
> ## Program name : recompile.sh
> ## Purpose : Recompile Invalid Database Objects for specified Shema in
> FLAG
> ## Author : C.S Waibale Simon
> ## Date written : 2002-03-19
>
> #for i in FLAGPASS CALLSPASS FLAGPASS CH1PASS CH2PASS CH3PASS ; do
> #j:=1
> #$i=${i:-$(crypt flag < passwds |awk '{print $j}')
> #done
>
> SQLPLUS=/ops/product/817/bin/sqlplus
> #Do not export the password variables !
> FLAGPASS=${FLAGPASS:-$(crypt flag < /usr/scripts/passwds |awk '{print $1}')}
> CALLS_PASS=${CALLS_PASS:-$(crypt flag < /usr/scripts/passwds |awk '{print
> $2}')}
> WHPASS=${WHPASS:-$(crypt flag < /usr/scripts/passwds |awk '{print $3}')}
> echo "Recompiling Invalid Database Objects in the FLAG instance"
> #This can be sustitued with generic code
> $SQLPLUS flag_calls/$CALLS_PASS_at_flag.mtn.co.ug @/ops/rom/recompile.sql
> $SQLPLUS flag/$FLAGPASS_at_flag.mtn.co.ug @/ops/rom/recompile.sql
> $SQLPLUS flag_wh/$WHPASS_at_flag.mtn.co.ug @/ops/rom/recompile.sql
>
> ---------recompile.log
> Recompiling Invalid Database Objects in the FLAG instance
> Message file sp1<lang>.msb not found
> Error 6 initializing SQL*Plus
> Message file sp1<lang>.msb not found
> Error 6 initializing SQL*Plus
> Message file sp1<lang>.msb not found
> Error 6 initializing SQL*Plus
>
> What could be broken ??
> The script runs correctly from comand prompt.
>
> ---
>
> +---------------------------------------------------+
> C.S Waibale Simon
> MTN-Uganda, 8th Floor UDB Building
> Cell: +256 77-212655,http://mtn.co.ug
> +---------------------------------------------------+
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Simon Waibale
> INET: waibals_at_mtn.co.ug
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
-- ---------------------------------------------------------------------------- James J. Morrow E-Mail: jmorrow_at_warthog.com Senior Principal Consultant Tenure Systems, Inc. Arlington, TX, USA "The reasonable man adapts himself to the world: the unreasonable man persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man." -- George Bernard Shaw -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: James J. Morrow INET: jmorrow_at_warthog.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Fri Mar 22 2002 - 22:33:21 CST