Originally posted by Darren Tomlinson
# Begin Module Header =========================================================## This file is intended to be sourced from within an hci cron entry# for the prupose of setting up the environment correctly## The cron environment is not the same as the hci environment# because the $HOME/.profile does not get run for cron jobs##========# Inputs:#========# hci_root=$1 hci_site=$2##==============# Normal Usage:#==============## Example of how to use this from cron to run batch_003 very night at 9:00 PM Monday thru Friday## 00 21 * * 1-5 /bin/ksh -c 'eval . ~/.profile.cron /quovadx/qdx5.2/integrator prod_batch; $HCISITEDIR/scripts/_003/iftp_003_cron_entry.ksh'## Example of how to echo the environemnt variables to files /hcitest/env.cron and /hcitest/path.cron at 11:47 AM## 47 11 * * * /bin/ksh -c 'eval . ~/.profile.cron /quovadx/qdx5.2/integrator prod_batch; env|sort >/hcitest/env.cron; parse_path >/hcitest/path.cron'###=========# History:#=========## 2002.05.08 Russ Ross# - wrote initial version.## 2005.04.12 Russ Ross# - modified for the QDX 5.2.2 upgrade.## 2008.09.09 Russ Ross# - modified for the QDX 5.6 rev2 upgrade.## End Module Header ============================================================#---------------------# define the functions#--------------------- . /quovadx/qdx5.6/integrator/mda_global/scripts/do_function.ksh#------------------------------------# define the default HCI profile PATH#------------------------------------ set_HCI_PROFILE_PATH#---------------------------------------------# Make sure our root and site are set#--------------------------------------------- setroot -clear setroot $hci_root $hci_site#---------------------------------------------# define other necessary environment variables#--------------------------------------------- set_IGNORE_VMFULL set_MDA_ARCHIVE_ROOT set_MDA_BATCH_ENV set_MDA_HCIROOT_OFF_LIST set_MDA_UPDIR
#!/usr/bin/kshfunction set_IGNORE_VMFULL { export IGNORE_VMFULL=1}function set_HCI_PROFILE_PATH { PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.:/usr/local/bin:/usr/local/scripts export PATH}function set_MDA_ARCHIVE_ROOT { export MDA_ARCHIVE_ROOT="/oldmsgs/5.6"}function set_MDA_BATCH_ENV { MDA_BATCH_ENV="`echo $HCISITE | cut -b 1-10`" if [[ "$MDA_BATCH_ENV" != "test_batch" && "$MDA_BATCH_ENV" != "prod_batch" ]]; then MDA_BATCH_ENV="bogus_batch" fi export MDA_BATCH_ENV=$MDA_BATCH_ENV}function set_MDA_HCIROOT_OFF_LIST { if [[ `hostname` = "mdahub4" || `hostname` = "mdahub8sna" || `hostname` = "mdahub8" || `hostname` = "mdahub9" ]]; then export MDA_HCIROOT_OFF_LIST="qdx5.2" fi}function set_MDA_UPDIR { export MDA_UPDIR="/upgrade"}function gohome { cd `grep "^$1:" /etc/passwd | awk -F: '{print $6}'`}function goprocs { cd $HCISITEDIR/exec/processes/$1}function goscripts { cd $HCISITEDIR/scripts/$1}function psgrep { echo "" ps -ef | head -1 ps -ef | grep $1 | grep -v grep echo ""}function set522 { setroot -clear setroot /quovadx/qdx5.2/integrator $1 showroot}function set56 { export ROOT="/quovadx/qdx5.6/integrator" export SITE=$1 currentDir=`pwd` cd $HOME . ~/.profile cd $currentDir}
Originally posted by Troy Morton
Originally posted by Gary Atkinson
cd /work; # or somewhere to hold the information files to be createdenv|sort >good.envecho $PATH:$FPATH | tr : '12' >good.pathfunctions >good.functions
cd /work; # or somewhere to hold the information files to be createdenv|sort >script.envecho $PATH:$FPATH | tr : '12' >script.pathfunctions >script.functions
## ****************************************************************************# document the cron environment **********************************************# ****************************************************************************## ----------------------# every day near 5:00 AM# ----------------------#02 05 * * * /bin/ksh -c 'eval . ~/.profile.cron /quovadx/qdx5.6/integrator prod_doc_mgt ; env|sort >$HCISITEDIR/cron.env; parse_path >$HCISITEDIR/cron.path; functions >$HCISITEDIR/cron.functions'07 05 * * * /bin/ksh -c 'eval . ~/.profile.cron /quovadx/qdx5.6/integrator prod_hdx ; env|sort >$HCISITEDIR/cron.env; parse_path >$HCISITEDIR/cron.path; functions >$HCISITEDIR/cron.functions'12 05 * * * /bin/ksh -c 'eval . ~/.profile.cron /quovadx/qdx5.6/integrator prod_ris ; env|sort >$HCISITEDIR/cron.env; parse_path >$HCISITEDIR/cron.path; functions >$HCISITEDIR/cron.functions'
export HOST=bhciigpexport CL_INSTALL_DIR=/hci/quovadx/qdx5.6export HOSTNAME=bhciigp.boone.orgeval `${CL_INSTALL_DIR}/integrator/sbin/hcisetenv -root ksh $*`
05,35 * * * * . ~/.profile.cron; /hci/bin/monitor/edb_check.tcl sitebn
#!/hci/quovadx/qdx5.6/integrator/bin/tclglobal HciRootset hciSite [lindex $argv 0]# Set up the environment for Cloverleaf commandseval [exec $HciRoot/sbin/hcisetenv -root tcl $HciRoot $hciSite]
Steve Carter wrote:Have you tried:* * * * * (setroot ; whatEver.script) >/dev/null 2>&1This assumes that you're utilizing hci's cron. This works fine for me.Steve
Steve Carter wrote:
/bin/sh: setroot: command not found
Originally posted by Chris Williams
set | more
Chris Williams wrote:When you log in as hci your environment is set automatically for you as part of the login process. From the system prompt, you should type in set | more which will allow you to page through ALL of your existing environment variables that apply to user hci.cron does not go through the same steps to set things up so you must explicitly set the environment variables you need for your cron jobs. If you are using the crontab file for user hci, you can place all these environment settings at the beginning of the crontab file above the job entries, and they will apply to all your cron jobs.
Chris Williams wrote:
Originally posted by Mark Thompson
#!/bin/kshFPATH=${1}/kshlibexport QUOVADX_INSTALL_DIR=`echo $1 | cut -d / -f1-3`eval `${QUOVADX_INSTALL_DIR}/integrator/sbin/hcisetenv -root ksh $1 $2`#setroot $1 $2tcl /home/hci/scripts/cyclesaveall.tcl $3