Shell Script Page
This page provides links to Shell Scripts written by Datagate users and contributed freely to this site.  All scripts can be considered open source.  Use of these scripts in a production environment is at the user's risk.


Current Offerings

    Name                                        Description
logmove.sh
logmove.README
Bob Dilworth's logmove (bourne) shell script and associated README file.  This script will archive orphaned log files in $DATAGATE/log to their appropriate archive directory (e.g., $DATAGATE/log/Jan-25).  This script was described in Tips and Tricks Vol1Num3.doc
idtable.sh
transtable.sh
IdtableAndTranstable.rtf
idtable and transtable are k-shell scripts that build a comma delimited file containing, in the case of  idtable, the message id isc file name and it's associated ssc file, and , in the case of transtable, the translation tsc file name and its inbound and outbound ssc files. The generated files are suitable for creating Microsloth Word (or other word processors) tables.  IdtableAndTranstable.rtf is the associated readme file (with examples) for the utilities.
queues2chk
QCheck
These two files comprise an automated Datagate queue checking/e-mail notification "system".  Please note that this script will  NOT work with e*gate (i.e., versions 4.0+) but should work with all "old-style" Datagate monk-centric versions (3.1, 3.5, and 3.6+).  I'm not at all familiar with version 2.6 and 3.0 so I have no idea if this script will work with those versions of the product.  Here at MCO we use Datagate 3.5 so I know it will definitily work with that version. 

The first file, queues2chk is the system's configuration file and contains, among other things,  the name of the Datagate port (comm client) to check, the number of backed-up messages allowed before notification takes place, and whether the queue (i.e., port) is "critical" - in other words whether it SHOULD be checked. 

The second file, QCheck, is a shell script that reads the config file and runs dgcmd on the "critical" queues to determine if there is a problem. Here at MCO we run the script via a crontab entry every 15 minutes (except between midnight and 8 am).   Problems here are defined as down queues, queues that are up but plugged up, and whether or not Datagate itself is up.  This file assumes that the queues2check config file is located in /dg2/mcoscripts.  To run it at your site you'll need to change this.  Additionally QCheck also uses the unix fuser command - your sys admin will no doubt have to grant your account privileges to run the fuser command.  If QCheck discovers a problem it sends an e-mail to the e-mail accounts hard-coded in the script.  You'll have to change these as well.  Here at MCO we've set up our Novell enviroment to forward these messages to our alpha pagers.  Please be aware that this will NOT run "right out of the box" at your site.  You WILL have to make the changes mentioned here as well as others I may have forgotten about.  Feel free to e-mail me at bdilworth@mco.edu with questions.  If you get this script  to run under versions 2.6, 3.0, 3.1, and/or 3.6+ please let me know so I can update this page to reflect that.

swapstats.sh
swapstats.rtf
swapstats.sh is a shell script that runs the swap -s command, parses the output to collect the amount of "Available" swap space left, and writes the output to a file.  The script is typically run from cron once an hour.  At midnight the collected statistics are e-mailed to the individual(s) coded in the script.  swapstats.sh is the script itself and swapstats.rtf is the Rich Field Text README file.  Contributed by J.D. Johnson, Community Health Systems, Inc.
delimited.sh
delimited_col.sh
delimited.dat
delimited.README
This script will create a Datagate 3.1/3.6 delimited structure (delimited.ssc) from a data file (delimited.dat).  This script was intended to be used with specs that can be copied and pasted into the data file, and the data file contains instructions for doing this.  The current data file will create a sample HL7 structure.  Contributed by Tom Brossard, Intermountain Health Care, Salt Lake city, Utah
fixed_width.sh
fixed_width_col.sh
fixed_width.dat
fixed_width.README
This script will create a Datagate 3.1/3.6 fixed-width structure (fixed_width.ssc) from a data file (fixed_width.dat).  This script was intended to be used with specs that can be copied and pasted into the data file, and the data file contains instructions for doing this.  The current data file will create a sample fixed-width structure.  Contributed by Tom Brossard, Intermountain Health Care, Salt Lake city, Utah

home