#!/bin/csh -f #+ # tvpower -- show or set state of DEIMOS guider power # # Purpose: # With no arguments, show the state of the DEIMOS TV guider power. # With appropriate arguments, turn guider power on, off, or cycle power. # # Type: # Csh script # # Usage: # tvpower [state] # # Arguments: # state = [on|off|cycle] Desired state for guider power # # Output: # Actions are echoed to STDOUT # # Exit values: # 0 = normal completion # 1 = bad number or type of arguments # # Example: # 1) Show current state of DEIMOS guider power: # tvpower # 2) Turn on DEIMOS guider power: # tvpower on # 3) Turn off DEIMOS guider power: # tvpower off # 4) Cycle DEIMOS guider power: # tvpower cycle #- # Modification history: # 2002-Jul-29 GDW Original version # 2005-Sep-05 GDW Add capability to show state #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd [on | off | cycle]" set on = 0 set off = 0 # check args... if ( $#argv > 1 ) then echo "$usage" exit 1 endif if ( $#argv >= 1 ) then set action = $1 shift endif # parse args... if ( $?action == 0 ) then show -s deimot tvpowset exit $status else if ( "$action" == "on" ) then set on = 1 else if ( "$action" == "off" ) then set off = 1 else if ( "$action" == "cycle" ) then set on = 1 set off = 1 else echo "$usage" exit 1 endif # carry out operations... if ( $off ) then printf "This should take about 6 seconds...\n" modify -s deimot tvpowset=off endif if ( $on ) then printf "This should take about 40 seconds...\n" modify -s deimot tvpowset=on endif printf "Done\n"