For cron jobs, I set up the environment like this:
~/.profile.cron
CL_INSTALL_DIR=/hci/quovadx/qdx5.6
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/local/lib:/usr/local/scripts:${CL_INSTALL_DIR}/integrato
export PATH
setroot
And then in I run the scripts in cron like this:
05 06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,22 * * * . ~/.profile.cron;/hci/bin/monitor/edb_check.tcl sitebn
05 06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,22 * * * . ~/.profile.cron;/hci/bin/monitor/edb_check.tcl sitebno
Here’s a portion of the script that demonstrates how to setup the environment in a tcl script:
#!/hci/quovadx/qdx5.6/integrator/bin/tcl
global HciRoot
set debug 0
if { $argc != 1 } {
puts “Usage: $argv0 siteName”
exit
}
set hostName [exec hostname]
if {$debug} {puts “hostName: $hostName”}
set hciSite [lindex $argv 0]
set date [clock format [clock seconds] -format %Y%m%d]
# Set up the environment for Cloverleaf commands
eval [exec $HciRoot/sbin/hcisetenv -root tcl $HciRoot $hciSite]
set hciDir $HciRoot/$hciSite/scripts/errors
# Get the number of lines in the error database. Ignore the header and footer (8 lines).
catch { exec hcidbdump -e | wc -l } lines
set lines [expr $lines – 8]
if {$debug} {puts “lines: $lines”}