› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › alerts using tcl
!#/bin/sh
#
exec hcitcl “$0” “$@”
OR
!#/usr/bin/env hcitcl
Thanks!
approach-1
#!/usr/bin/ksh
# this line to escape the next line from the tcl interpreter
exec hcitcl “$0” “$@”
rather than “approach-2
!#/usr/bin/env hcitcl
Both might be fine if you never do a cloverleaf upgrade.
Also this is the first time I’ve seen approach-2, so other comments will be of interest.
I know approach-1 will dynamically handle picking the right version of hcitcl during the upgrade phase when you might be running multiple versions of cloverleaf.
I do not know if using the environment to select hcitcl (approach-2) will correctly handle this upgrade overlap phase.
My suspicion is that approach-2 might only pick the most recent version of cloverleaf environment, esepcially if its behavior is influenced by /etc/environment.
I would be curious about what determines which hcitcl interpreter approach-2 picks; it will need to pick 2 different versions when multiple versions of Cloverleaf are being used for it to be advantageous.
Russ Ross
RussRoss318@gmail.com
{VALUE lastr} {SOURCE ib_pathnet_8015} {MODE actual} {WITH 1} {COMP {>= 900}} {FOR {nmin 10}} {WINDOW {* * 7-18 * * 1-5}} {HOST {}} {ACTION {{exec {recycle_thread_alert.ksh weekday__ib_pathnet_8015 ‘LIS Admins – recycle Pathnet queue manager HF1 because it has not sent cloverleaf ib_pathnet_8015 anything for at least ten minutes’ ib_pathnet_8015 ib_pathnet_8015}}}}
Granted it is using KSH and not TCL but I fully expect both to work.
In this sample entry above the ACTION part calls KSH script recycle_thread_alert.ksh and passes the following 4 command line args
‘LIS Admins – recycle Pathnet queue manager HF1 because it has not sent cloverleaf ib_pathnet_8015 anything for at least ten minutes’
ib_pathnet_8015
ib_pathnet_8015
Russ Ross
RussRoss318@gmail.com
As for running your Tcl procs, I see no reason to exec hcitcl or anything like that. If you are on Unix, simply write a stan-alone Tcl proc, make it executable, and put it in the path ($HCISITEDIR/scripts). If on Windoze, simply put an htc suffix and put in the path.
The simpliest, generic method to set up a stand-alone Tcl procedure on Unix is to put the following at the begiing of the script. Remeber that on Unix or Windoze, argv will contain a list of arguments while argc will be the number of arguments. So from Alerts, simply exec the scrip with it’s arguments.
This is not brain surgery here
#!/bin/sh
# If not running Cloverleaf 5.x, you will probably have to change the next # line to point to the full path for Tcl.
# The following line is seen as a continued comment by Tcl
exec $QUOVADX_INSTALL_DIR/integrator/bin/hcitcl “$0″ ${1+”$@”}
proc myproc (argv argc) {
.
.
}
myproc $argv $argc
The script you are asking about called recycle_thread_alert.ksh happens to be a global object because any site that has alerts turned on will use it.
The beauty of creating a global site is that Cloverleaf upgrades will treat it like a any other site and do any needed conversions.
So back to your question about where is it in the path.
I modified the path so every site environment has an extra scripts directory; one for the global scripts.
By default there is also a path to a site specific scripts directory if you decide to create one.
Let’s look at the the prod_lis site as an example
When I run my parse_path.ksh script (note $FPATH is a sneaky part of the path that is hidden and often overlooked)
#!/usr/bin/ksh
echo $PATH:$FPATH | awk -F: ‘{for (i=1;i<=NF;i++) print $i}'
here is what I get as output for my path
/quovadx/qdx5.2/integrator/prod_lis/scripts
/quovadx/qdx5.2/integrator/bin
/quovadx/qdx5.2/integrator/mda_global/scripts
/quovadx/qdx5.2/integrator/contrib
/quovadx/qdx5.2/integrator/sbin
/quovadx/qdx5.2/integrator/dbms/bin
/quovadx/qdx5.2/integrator/tcl/bin
/quovadx/qdx5.2/integrator/clgui/bin
/quovadx/qdx5.2/integrator/clgui/java/bin
/quovadx/qdx5.2/integrator/usercmds
/usr/bin
/etc
/usr/sbin
/usr/ucb
/home/hci/bin
/usr/bin/X11
/sbin
.
/usr/local/bin
/usr/local/scripts
The way I choose to accomplish this was by modifying hcisetenv by adding the bolded line below in the right place
“$root/mda_global/scripts”,
“$root/contrib”,
“$hcibin”,
“$root/dbms/bin”,
“$root/tcl/bin”,
“$root/clgui/bin”,
“$root/clgui/java/bin”,
“$usercmd”,
$ENV{‘PATH’}));
I’m not sure if you really wanted to know about my pathing because like Charlie says there is more than one way to skin a cat.
Deciding where to put something and what to call the paths is not hard and fast but making a decision and creating standards for everyone at your facility to follow is one of the best things you can do.
If you are asking about the pathing because you can’t locate my script, then my answer will not be of any help because I wrote the script.
Refer to this URL for a copy of the script if that is what you are looking for
https://usspvlclovertch2.infor.com/viewtopic.php?t=1806https://usspvlclovertch2.infor.com/viewtopic.php?t=1806
Russ Ross
RussRoss318@gmail.com
Thanks for all this information. I did find out that someone before I came along created directory called “cscripts”, which was not in the path. I have adjusted the PATH. We have a very small engine, with only one site, so this should be ok for us. I’ve only been using Unix and Cloverleaf for that matter for a few months, so I learn something new each day.
Gary