#!/bin/csh -fv # written by Kevin P. Inscoe (kevin@inscoe.org) # http://www.inscoe.org/ondemand # April 1, 1999 # Fetches the OnDemand System Log into unix ascii file # Global Variables set host = `/bin/hostname` set logfile = "/var/log/ars_system.log" set ADMIN = "admin" set PASSWORD = "jazman11" set sleeptime = 900 # 15 minutes # last hour of the day (24 hour) to run @ lasthour = 23 set flag = 0 set tmp = "/tmp/ars_system.tmp" set pidfile = "/etc/get_od_system_log.pid" # Annouce ourselves /bin/echo "+++++++++++++++++++++++++++++++++++++++++++" /bin/echo $0 "Starting at `/usr/bin/date`" # Stuff the pidfile set pid = `/bin/ps -o "%P" | /bin/head -2 | /bin/tail -1` /bin/echo $pid > $pidfile top: # cleanup from last time /bin/rm -f $tmp # Using Named Query method /usr/lpp/ars/bin/arsquery -h $host -u $ADMIN -p $PASSWORD -v -o $tmp -q SystemLog -f "System Log" /bin/cat $tmp >> $logfile /usr/bin/chmod 755 $logfile # Using query method #/usr/lpp/ars/bin/arsquery -h $host -u $ADMIN -p $PASSWORD -c -v -o $logfile -f "System Log" -i "where time_stamp > 19990301" # check to see if we are still in our window... @ hour = `/usr/bin/date '+%H'` echo "hour=" $hour echo "lasthour=" $lasthour if ( $hour > $lasthour ) goto bail # goto sleep /bin/echo "sleeping..." sleep $sleeptime goto top bail: # # our tour of duty is over..time to bail # /bin/echo $0 "hour=" $hour "lastrun completed...exiting at `/usr/bin/date`" exit 0