Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ISQL Report via Script

Status
Not open for further replies.

cobdeng

MIS
Oct 14, 2004
19
GB
Being relatively new to scripting, I am looking for some guidance

I have the following line in my shell script:-
isql < /comwise343/sql/hclockbypg_all.arc

However, each time it fails with the error:-
/root/bin/check_locked_diaries[7]: isql: not found.

The report hclockbypg_all.arc definitely exists in the specified directory - with correct permissions.

Can someone help with a resolution please
 
Are you running this via cron? If not, is the </path/to/isql/> included in your $PATH variable (echo $PATH to find out)? It sounds as if the script can't find isql for some reason. Post back and we'll see where we go from there.
 
Ken

Yes, its being run from crontab as follows

# run the locked diaries report at 0100 every day
0 1 * * * /root/bin/check_locked_diaries 2>/home/cobdeng/diary_err

Script and Errors as previous post

 
Okey-dokey. It's the perennial problem that cron runs in a (very) limited environment. If the job runs OK interactively, check the $PATH it's using (as above) and replicate that either somewhere within the script or in a wrapper which kicks off the script. An alternative (if running as root) is:

<cron times, dates etc> su - <user> -c "<command>"

which will invoke the user's .profile (and therefore environment) before executing the script. HTH.
 
You may set the informix environment in your script if not present at execution time.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I second that. When I run ISQL through a KSH script I make sure that these variables are setup before hand in the script:

INFORMIXDIR=/usr/informix
TERMCAP=$INFORMIXDIR/etc/termcap
PATH=$INFORMIXDIR/bin:$PATH
DBDATE=DMY2
DBTEMP=/tmp
INFORMIXSERVER=h70_se

export INFORMIXDIR TERMCAP PATH DBDATE INFORMIXSERVER DBTEMP

I hope that helps?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top