#!/bin/csh -f # # start_check_keywords -- launch the start_keywords program # # Purpose: # Run start_keywords program to monitor keywords and send output to logfile # # Usage: # start_check_keywords spec|imag # # Type: # c-shell script # # Modification history: # 2002-Oct-04 GDW Original version # 2010-Sep-21 jlyke Adapted for OSIRIS # 2021-Mar-17 jlyke Updated for new host #----------------------------------------------------------------------- # set defaults... set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd spec|imag" set logdir = $SERVER_SYSLOGDIR/osiris/scripts # verify args... if ( $#argv != 1 ) then printf "$usage\n" exit 1 endif switch ($1) case "S*": case "s*": set M = "s" set mode = "spec" breaksw case "I*": case "i*": set M = "i" set mode = "imag" breaksw default: printf "$usage\n" exit 1 breaksw endsw # build mode-dependent variables set search = "check_keywords ${mode}" set logfile = ${logdir}/check_keywords_${mode}.log # check for running process... set process = ( `/usr/bin/ps -ax | grep -v $cmd | grep -v grep | grep "$search" | awk '{print $1}'` ) if ( $#process != 0 ) then printf "$cmd ERROR! Script already running - aborting\n\007" exit endif # verify that the logfile exists and is writeable... if ( ! -w $logfile ) then printf "$cmd ERROR! logfile $logfile is not writeable - aborting\n\007" exit endif # launch script... $search -verbose >> $logfile & exit