Name: nirpsec_watch
Directory: /home/hanakapiai/nirspec/bin
Purpose: NIRSPEC server and cryo alarm script.



#!/bin/csh
#
# Csh script to periodically check NIRSPEC cryo temperatures.
#
set whonotify = ( aconrad k1tel k2tel teloper \
 		  dlester dmcbride rlaub bmoskitis emorris bmason \
		  tstickel schaefer teresac rquick chucks garyp wwack jaycock \
                  tbida randyc goodrich dspray gwirth \
		  echock ahoney \
		  larkin@astro.ucla.edu mclean@astro.ucla.edu \
		  brims@astro.ucla.edu canfield@astro.ucla.edu )
set whoserver = ( aconrad \
 		  echock ahoney \
		  tstickel schaefer teresac rquick chucks garyp wwack jaycock \
                  tbida dspray \
		  larkin@astro.ucla.edu )
set whotmp = ( tbida aconrad randyc dspray )
#
#  Check the status of the server by reading 1 keyword.
#
loop:
set scratch = `show -s nirspec cryotemp1`
 if ( $status ) then
    /usr/ucb/mail -s \
        "NIRSPEC server processes are stopped." \
        "$whotmp" < /home/waimea/nirspec/bin/server.txt
   exit 1
 endif
#
#  Read the temperature keywords.
#
set cryo2 = `show -s nirspec -terse cryotemp2`
set cryo5 = `show -s nirspec -terse cryotemp5`
set cryo9 = `show -s nirspec -terse cryotemp9`
#
set temp     = `echo $cryo9[1]  | /usr/bin/sed "s/\./ /"`
set aladdin  = $temp[1]
#
set temp     = `echo $cryo5[1]  | /usr/bin/sed "s/\./ /"`
set ln2can  = $temp[1]
#
set temp     = `echo $cryo2[1]  | /usr/bin/sed "s/\./ /"`
set ccr  = $temp[1]
#
# Enable LN2 can check only during cooldowns.
#
set checkln2 = 0
if ( $checkln2 ) then
 if( $ln2can > 75 ) then
     rsh kalama \
       "cat /home/waimea/nirspec/bin/ln2.aud > /dev/audio"
 endif
#
 if( $ln2can > 75 ) then
     rsh waialea \
       "cat /home/waimea/nirspec/bin/ln2.aud > /dev/audio"
 endif
#
 if( $ln2can > 75 ) then
     /usr/ucb/mail -s \
 	"URGENT: NIRSPEC LN2 needs refilling\!" \
      "$whonotify" < /home/waimea/nirspec/bin/ln2.txt
 endif
endif
#
if( $ccr > 15 ) then
     rsh kalama \
       "cat /home/waimea/nirspec/bin/ccr.aud > /dev/audio"
endif
#
if( $ccr > 15 ) then
     rsh waialea \
       "cat /home/waimea/nirspec/bin/ccr.aud > /dev/audio"
endif
#
if( $ccr > 15 ) then
     /usr/ucb/mail -s \
 	"URGENT: NIRSPEC CCR cooling has stopped\!" \
      "$whonotify" < /home/waimea/nirspec/bin/ccr.txt
endif
#
#
sleep 150
goto loop
#