Re: Running SQL as a cron job
Posted in 1997
In article <5mhic2$8qv@cssun.mathcs.emory.edu>, Denham.M@amstr.com
writes
>Set the informix environment up in the script that runs dbaccess:
>
>For example (assumes online):
>
>INFORMIXDIR=/usr/informix
>INFORMIXSERVER=testserver
>
>export INFORMIXDIR INFORMIXSERVER
>
>PATH=$INFORMIXDIR/bin:$PATH>
>dbaccess testdb sqlfile
>
>That should do it, remember to redirect output to a file if you are doing
>selects.
>
Yep - Hint I normal have two scripts called live and demo
the live script sets up ALL environment variables with no reference to
existing values. Same for demo. Suppose the full path to the live
script is /home/davew/live, the putting
. /home/davew/live
in a script (yes that is a dot) will setup the live enviroment FOR THE
CURRENT SHELL and you can then add whatever commands you want to run
afterwards.
Also allows you to type
. live
or
. demo
at the UNIX prompt and get the correct enviroment variables setup.
I normally have the live and demo scripts contain a
echo "Setting up live environment"
or similar so you can tell which enviroment they pickup when they run.
Also under cron this will be mailed to you so you can see that it
did run.
>Mark
>
>MarkDenham@aol.com (home)
>Denham.M@amstr.com (work)
>--------------------------( Forwarded letter 1 follows )---------------------
>Date: Wednesday, 28 May 1997 4:50am
>X-Originating-IP: [198.133.29.51]
>From: "SH Lim" <sweehock@hotmail.com>
>To: informix-list@rmy.emory.edu
>Subject: Running SQL as a cron job
>Date: Wed, 28 May 1997 03:42:53 PDT
>Sender: informix-list-owner@rmy.emory.edu
>Reply-To: sweehock@hotmail.com
>X-Informix-List-Id: <list.14670>
>
>Helper(s),
> Is there any way that I can run a SQL through dbaccess - <sqlfile>
>specified as a cron job in AIX.
> I've tried it this "/usr/informix/bin - /usr/informix/sqlfile.sql" as the
>command to the cron. There's a -32766 error which upon investigation could be
>INFORMIXDIR set incorrectly.
> Any idea how I can do this ?
>
>
>---------------------------------------------------------
>Get Your *Web-Based* Free Email at http://www.hotmail.com
>---------------------------------------------------------
--
David Williams