1753408 Members
7278 Online
108793 Solutions
New Discussion юеВ

environment variables

 
khilari
Regular Advisor

environment variables

Hi guys, okay well i had made a cron but it is not working. What we are doing is that we r using sftp to send a file each morning but we get the following error:

/usr/lib/dld.sl: Can't find path for shared library: libtcl8.3.sl
/usr/lib/dld.sl: No such file or directory
/home/ops/wsib/ftpscripts/copy_to_emergis: 14857 Abort(coredump)

Any ideas. Thanks.
5 REPLIES 5
Arunvijai_4
Honored Contributor

Re: environment variables

Hi khilari,

Do you have TCL installed on the machine where you run this job ? If yes, you may have to create a symbolic link to /usr/lib or /usr/local/lib

-Arun

"A ship in the harbor is safe, but that is not what ships are built for"
A. Clay Stephenson
Acclaimed Contributor

Re: environment variables

The subject of your posting indicates the solution. Cron intentionally has a very sparse environment and the user's .profile is not sourced. Your cron'ed scripts needs to explicitly set and export any needed environment variables. This is typically done very early in the script.

In your case, it appears that you need to export SHLIB_PATH and PATH.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: environment variables

And to amplify Clay's answer, you need to examine your entire cron job for *all* enviroment variables that will be needed. Put these in all scripts used in cron (or at or batch). cron does not login so it is a different environment.


Bill Hassell, sysadmin
khilari
Regular Advisor

Re: environment variables

Well, below is the environment variable of the user as it stands right now.
(sjh): /hci $ env | more
_=/usr/bin/env
DBDPATH=/quovadx/qdx5.2/integrator/prodsite/exec/databases
MANPATH=/quovadx/qdx5.2/integrator/man:/quovadx/qdx5.2/integrator/tcl/man:/quova
dx/qdx5.2/integrator/dbms/man:/usr/share/man/%L:/usr/share/man:/usr/contrib/man/
%L:/usr/contrib/man:/usr/local/man/%L:/usr/local/man:/opt/mx/share/man:/opt/upgr
ade/share/man/%L:/opt/upgrade/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/
opt/pd/share/man/%L:/opt/pd/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/op
t/resmon/share/man:/opt/hparray/share/man/%L:/opt/hparray/share/man:/opt/graphic
s/common/man:/usr/dt/share/man:/opt/samba/man:/opt/gnome/man:/opt/ignite/share/m
an/%L:/opt/ignite/share/man:/opt/wbem/share/man:/opt/perf/man/%L:/opt/perf/man:/
opt/ssh/share/man
TCL_LIBRARY=/quovadx/qdx5.2/integrator/tcl/lib/tcl8.3
TCLX_LIBRARY=/quovadx/qdx5.2/integrator/tcl/lib/tclX8.2
DBFPATH=/quovadx/qdx5.2/integrator/prodsite/exec/databases
FPATH=/quovadx/qdx5.2/integrator/kshlib
SHXMON_INTERVAL=5
SHLIB_PATH=/quovadx/qdx5.2/integrator/clgui/java/lib/PA_RISC:/quovadx/qdx5.2/int
egrator/clgui/java/lib/PA_RISC/hotspot:/quovadx/qdx5.2/integrator/lib:/quovadx/q
dx5.2/integrator/bin:/quovadx/qdx5.2/integrator/tcl/lib:/quovadx/qdx5.2/integrat
or/dbms/lib:/usr/lib:/lib:/shlib:/usr/shlib
PATH=/quovadx/qdx5.2/integrator/prodsite/bin:/quovadx/qdx5.2/integrator/prodsite
/scripts:/quovadx/qdx5.2/integrator/bin:/quovadx/qdx5.2/integrator/contrib:/quov
adx/qdx5.2/integrator/sbin:/quovadx/qdx5.2/integrator/dbms/bin:/quovadx/qdx5.2/i
r/ucb:/home/hci/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/local/scripts
COLUMNS=80
DBTMP=/quovadx/qdx5.2/integrator/prodsite/exec/databases
HCISITE=prodsite
ator/clgui/lib/cljava.jar:/quovadx/qdx5.2/integrator/java_uccs:
LOGNAME=hci
HCILICFILE=/quovadx/qdx5.2/integrator/vers/license.dat
DEV_NULL=/dev/null
ERASE=^H
LOCKMGR=lm_qdx5.2_prodsite
TIX_LIBRARY=/quovadx/qdx5.2/integrator/tcl/lib/tix4.1
BLT_LIBRARY=/quovadx/qdx5.2/integrator/tcl/lib/blt8.0
HCISITEDIR=/quovadx/qdx5.2/integrator/prodsite
TKX_LIBRARY=/quovadx/qdx5.2/integrator/tcl/lib/tkX8.2
SHELL=/sbin/sh
HCIROOT=/quovadx/qdx5.2/integrator
QUOVADX_INSTALL_DIR=/quovadx/qdx5.2
HOME=/home/hci
TERM=ansi
PWD=/home/hci
TZ=EST5EDT
HCIVERSION=5.2
LINES=25


I havnt quite done anything like this before, any one can give step by step info. Or any other resource i can go and look at..

Thanks.
Bill Hassell
Honored Contributor

Re: environment variables

Actually, you have to understand what the commands in your script require. While you could certainly just copy/paste the env list into your script, most of the environment variables are not necessary. Certainly you need the SHLIB_PATH value but the rest of the variables you would have to research. If you're in a bind for time, I would just do this:

From your login:

env > myEnv

Then in your script which should start like this:

#!/usr/bin/sh

. $HOME/myEnv

...rest of script...

NOTE: There is a dot then space before $HOME/myEnv. This will 'source' your environment without messing up the appearance of the script too much.


Bill Hassell, sysadmin