Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cron job fails running script

278 views
Skip to first unread message

denise

unread,
May 21, 2007, 6:19:40 PM5/21/07
to
I have a job that runs 3 sql scripts and creates output for
each. When I manually run the job it works but it fails when
cron runs it. Can anyone help me see what it's missing? Do I
need to add the path to something? Thanks for any ideas!

#!/bin/ksh
#
isql -Uname -Ppasswd <creattemptlb.sql> out1
isql -Uname -Ppasswd <notprint.sql> out2
isql -Uname -Ppasswd <droptemptbl.sql> out3
cat out1 | mailx -s "create table" d...@mgh.org
cat out2 | mailx -s "not printed" d...@mgh.org
cat out3 | mailx -s "drop table" d...@mgh.org

Mark A. Parsons

unread,
May 21, 2007, 10:11:01 PM5/21/07
to
Ummmmm ...

- provide some info/details as to how they're failing?

- make sure the script soures the appropriate resource file in the $SYBASE directory (usually SYBASE.sh or SYBASE.csh)

denise

unread,
May 22, 2007, 8:57:58 AM5/22/07
to
Sorry! The error messages are:
A file or directory in the path name does not exist.
/SYBASE/reports/get_notprinted: create_temp_tbl.sql:
0403-016 cannot find or open the file.
cat: 0652-050 cannot open output

How do I find what the resource file should be?
Thanks very much!

donmillion

unread,
May 22, 2007, 12:23:32 PM5/22/07
to
First guess would be environment variables. When cron jobs
start up they have NO environment variables set except
$HOME. I created a file called sybenv.h that I include in
all of my cron scripts to set all of the necessary
environment variables.

denise

unread,
May 22, 2007, 12:57:37 PM5/22/07
to
What environment variables does a cron job need set to run a
sql script using isql?

donmillion

unread,
May 22, 2007, 1:21:14 PM5/22/07
to
> What environment variables does a cron job need set to run
> a sql script using isql?

Depends. If you want to execute isql without specifying a
full path name then you'll have to have a PATH variable that
includes your OCS../bin directory. If you don't want to
specify the -S option in your isql command then you'll have
to set DSQUERY. And so on.

Probably the easiest thing to do is log in as sybase, do an
env and see what variables are set that you think you might
want.

At the very least I would probably set the SYBASE variable.

Michael Peppler

unread,
May 22, 2007, 2:19:00 PM5/22/07
to
On Tue, 22 May 2007 10:57:37 -0700, denise wrote:

> What environment variables does a cron job need set to run a
> sql script using isql?

The easiest is to source the SYBASE.sh file from the root of the Sybase
installation directory.

Michael
--
Michael Peppler - Peppler Consulting SaRL
mpep...@peppler.org - http://www.peppler.org
Sybase DBA/Developer - TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ - http://www.peppler.org/FAQ/linux.html

0 new messages