Re: export from crontab

  • From: Mark Bole <makbo@xxxxxxxxxxx>
  • Date: Thu, 24 Feb 2005 09:47:22 -0800

Raghu Kota (WBTQ) wrote:
> Hi Friends,
> 
> Iam trying to run an export from crontab on last Thursday of every =
> month, the logic seems working but I got an error saying invalid Time =
> Zone!! with this error "ORACLE error 1857 encountered", without this =
> Thursday checking logic everything works! my environment is oracle8174 =
> on aix51. Any ideas where Iam doing wrong??
> 
> TIA
> Raghu.
> 
> My export Script:-
> variables here...
> 
> #####################Check for last Thursday of the month##########
> 
> TODAYMONTH=3D`date +%m`
> # subtract 168 hours (one week from the TZ parameter)
> # in my case TZ=3DEST5EDT
> TZ=3DEST-162EDT
> NEXTWKMONTH=3D`date +%m`
> if [ $TODAYMONTH -ne $NEXTWKMONTH ]
>  then
>   #it's the last Thursday of the month
>   echo "Oracle Export: `date`" >>${LFILE} 2>&1
>  else
>   echo "Sorry!! Today is not last Thu of the Month!! : `date`" =
> 
>>>${LFILE} 2>&1
> 
>   exit 1
> fi
> 
[...]
> 
> error:-Export: Release 8.1.7.4.0 - Production on Thu Mar 3 00:00:34 2005
> 
> (c) Copyright 2000 Oracle Corporation.  All rights reserved.
> 
> 
> EXP-00056: ORACLE error 1857 encountered
> ORA-01857: not a valid time zone
> Username:
> EXP-00030: Unexpected End-Of-File encountered while reading input
> EXP-00000: Export terminated unsuccessfully


It doesn't seem very wise to be changing your TZ variable on the fly to 
such an unorthodox value, especially since this appears to be causing 
your ORA error.

A quick search of Google yielded the following sample crontab entry, 
which seems to be exactly what you want (even down to the Thursday choice):

0 1 25-31 * * [ "$(date +\%a)" == "Thu" ] && script_with_no_date_logic

http://unix.derkeiler.com/Mailing-Lists/AIX-L/2005-02/0023.html

-- 
Mark Bole
http://www.bincomputing.com



--
//www.freelists.org/webpage/oracle-l

Other related posts: