#!/bin/bash ######################################################################## # filename: usrcmds # # description: Use to enable/disable the node users commands. Will # also report the current user command status. # # usage: usrcmds [0|OFF|DISABLE|1|ON|ENABLE][Q|S|V] # where: # 0 | OFF | DISABLE :disable user command functions. # 1 | ON | ENABLE :enable user command functions. # Q(uiet) :disable audible responces # S(hort) :send confirmation tones # V(erbose) :send status in CW # # history: ######################################################################## # # Function to send a 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) touch ${LOCAL}/nouser &>/dev/null ;; 1 | ON | ENABLE) rm -f ${LOCAL}/nouser &>/dev/null ;; Q | S | V) VERBOSITY=$1 ;; *) echo "${0##*/}: unknown argument (${1})" ;; esac shift done # # Report the current User Commands Functions status # case $VERBOSITY in V) if [ -f ${LOCAL}/nouser ] ; then send_cw "USER CMDS OFF" else send_cw "USER CMDS ON" fi ;; S) ${CUSTOM}/confirm ;; esac exit