#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/sbin/perf/diag_tool/pdt_config.sh 1.12 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1992,1993 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)41 1.12 src/bos/usr/sbin/perf/diag_tool/pdt_config.sh, pdt, bos720 11/7/03 12:07:16 # # COMPONENT_NAME: pdt # # FUNCTIONS: none # # ORIGINS: 27 # # # (C) COPYRIGHT International Business Machines Corp. 1992, 1993 # All Rights Reserved # Licensed Materials - Property of IBM # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # # shell script to allow the user to customize certain aspects of # pdt. This includes enabling/disabling/modifying collection, # and reporting. # # this is to be run as root # # access the configuration directory cd /var/perf/cfg/diag_tool # clear while true do print -u2 " " print -u2 "________________PDT customization menu__________________" print -u2 " " PS3='Please enter a number: ' select i in 'show current PDT report recipient and severity level' \ 'modify/enable PDT reporting' \ 'disable PDT reporting' \ 'modify/enable PDT collection' \ 'disable PDT collection' \ 'de-install PDT' \ 'exit pdt_config' do clear case $i in #----------------------------- 'show current PDT report recipient and severity level') # The following goes to stdout if test -f .reporting.list then print -u2 "current PDT report recipient and severity level" cat .reporting.list | sed '/^#/d' # cat file, remove comments else print "reporting has been disabled (file .reporting.list not found)." fi;; #------------------------------ 'modify/enable PDT reporting') print -u2 "enter id@host for receipt of report " read -r "userid?press enter or type 'null' to generate report but not emailed:" || return 1 read -r "severity?enter severity level for report (1-3): " || return 1 # validate that $severity is a integer and between 1-3 while true do case "$severity" in 1|2|3) break;; *) print -u2 "please enter level between 1-3" read -r "severity?enter severity level for report (1-3): ";; esac done clear if [ "`echo $userid`" != "" ] then echo $userid $severity > .reporting.list else #To make sure reports are not emailed. PMR#35315,370,000 echo 'null' $severity > .reporting.list fi print -u2 "report recipient and severity level" cat .reporting.list chmod 644 .reporting.list # make sure is readable by others chown adm:adm .reporting.list;; # make adm the owner #------------------------------ 'disable PDT reporting') print -u2 "disable PDT reporting done" rm .reporting.list;; #------------------------------- 'modify/enable PDT collection') # # get a copy of user adm's cron table # simultaneously remove all current references to pdt # [do this to avoid adding multiple invocations if this option is # mistakenly selected multiple times] # cronadm cron -l adm | \ sed "/ \/usr\/sbin\/perf\/diag_tool\/Driver_ /d" >/tmp/.diag_tool.cron \ || exit 1 # # concatenate new cron entries to end of copy of adm's table # cat <>/tmp/.diag_tool.cron || exit 1 0 9 * * 1-5 /usr/sbin/perf/diag_tool/Driver_ daily 0 10 * * 1-5 /usr/sbin/perf/diag_tool/Driver_ daily2 0 21 * * 6 /usr/sbin/perf/diag_tool/Driver_ offweekly EOF # # store the new cron table # chown adm.adm /tmp/.diag_tool.cron || exit 1 su - adm "-c crontab /tmp/.diag_tool.cron" || exit 1 # # clean up # print -u2 "modify/enable PDT collection done" rm /tmp/.diag_tool.cron || exit 1;; #-------------------------------- 'disable PDT collection') # # remove all entries in the cron table that refer to the pdt directory # cronadm cron -l adm | \ sed "/ \/usr\/sbin\/perf\/diag_tool\/Driver_ /d" > /tmp/.diag_tool.cron \ || exit 1 # # store the new cron table # chown adm.adm /tmp/.diag_tool.cron || exit 1 su - adm "-c crontab /tmp/.diag_tool.cron" || exit 1 # # clean up # print -u2 "disable PDT collection done" rm /tmp/.diag_tool.cron || exit 1;; #--------------------- 'de-install PDT') # These lines go to stdout echo ' ' echo ' PDT is installed as package bos.perf.diag_tool in the bos lpp.' echo ' Use the installp facility to remove the package';; #-------------------------- 'exit pdt_config') exit;; esac break done done # while statement