#!/bin/bash ######################################################################## # filename: timeout # # description: Use to enable/disable the activity timeout timer. Will # also report the current activity timeout timer status. # # usage: timeout [0|OFF|DISABLE|1|ON|ENABLE][Q|S|V] # where: # 0 | OFF | DISABLE :disable the activity timeout time. # 1 | ON | ENABLE :enable the activity timeout time. # Q(uiet) :disable audible responces. # S(hort) :send confirmation tones. # V(erbose) :send status in CW. # ######################################################################## # # Function to CW message # function send_cw () { ${BIN}/key usleep ${TXDELAY:-500000} /usr/local/bin/sccw -t "${1}" &>/dev/null usleep 500000 ${BIN}/unkey } ######################################################################## # # Convenience functions # # Send message to LOGFILE function log () { MESSAGE=$@ if [ -n "$LOGFILE" ]; then echo "`date '+%b %d %Y %T %z'` ${0##*/}: $MESSAGE" >> $LOGFILE fi } ####################################################################### # # Standard Script Opening # # Make sure we are user repeater!!! if [ `/usr/bin/whoami` != "repeater" ] ; then echo This program must be run as user REPEATER! exit 1 fi # Make sure we have sourced the environment file if [ "$RUN_ENV" != "TRUE" ] ; then . /home/irlp/custom/environment fi # # Default verbosity is S(hort); Status verbosity # is defaulted to V(erbose). # if [ "$#" = "0" ] ; then VERBOSITY="V" else VERBOSITY="S" fi # # Process the arguments # while [ -n "$1" ] ; do case $1 in 0 | OFF | DISABLE) rm -f ${LOCAL}/timeout &>/dev/null ;; 1 | ON | ENABLE) touch ${LOCAL}/timeout &>/dev/null ;; Q | S | V) VERBOSITY=$1 ;; *) echo "${0##*/}: unknown argument (${1})" ;; esac shift done # # Report the current Activity Timeout Timer status # case $VERBOSITY in V) if [ -f ${LOCAL}/timeout ] ; then send_cw "TIMEOUT ON" else send_cw "TIMEOUT OFF" fi ;; S) ${CUSTOM}/confirm ;; esac exit