[ Pobierz całość w formacie PDF ]
.${THISHOST}.$DATETIME############################################################# DEFINE FUNCTIONS HERE ###############################################################get_host (){# Hostname of this machinehostname# uname -n works too}#################################################get_OS (){# Operating System - AIX or exituname -s}#################################################get_OS_level (){# Query for the operating system release and version leveloslevel}#################################################get_ML_for_AIX (){# Query the system for the maintenance level patch setinstfix -i | grep AIX_MLListing 13.2 AIXsysconfig.ksh shell script listing.(continued)Taking a System Snapshot 343echo \noslevel -r}#################################################get_TZ (){# Get the time zone that the system is operating in.cat /etc/environment | grep TZ | awk -F = {print $2}}#################################################get_real_mem (){# Query the system for the total real memoryecho $(bootinfo -r)KB# lsattr -El sys0 -a realmem | awk {print $2} Works too}#################################################get_arch (){# Query the system for the hardware architecture.Newer# machines use the -M switch, and the older Micro-Channel# architecture (MCA) machines use the -p option for# the uname command.ARCH=$(uname -M)if [[ -z $ARCH && $ARCH = ]]thenARCH=$(uname -p)fiecho $ARCH}#################################################get_devices (){# Query the system for all configured deviceslsdev -C}#################################################Listing 13.2 AIXsysconfig.ksh shell script listing.(continues)344 Chapter 13get_long_devdir_listing (){# Long listing of the /dev directory.This shows the# device major and minor numbers and raw device ownershipls -l /dev}#################################################get_defined_disks (){# List of all defined diskslsdev -Cc disk}#################################################get_defined_pdisks (){# List of all defined pdisks for SSA diskslsdev -Cc pdisk}#################################################get_tape_drives (){# Query the system for all configured tape driveslsdev -Cc tape}#################################################get_cdrom (){# Query the system for all configured CD-ROM deviceslsdev -Cc cdrom}#################################################get_adapters (){# List all configured adapters in the systemlsdev -Cc adapter}Listing 13.2 AIXsysconfig.ksh shell script listing.(continued)Taking a System Snapshot 345#################################################get_routes (){# Save the network routes defined on the systemnetstat -rn}#################################################get_netstats (){# Save the network adapter statisticsnetstat -i}#################################################get_fs_stats (){# Save the file system statisticsdf -kecho \nmount}#################################################get_VGs (){# List all defined Volume Groupslsvg | sort -r}#################################################get_varied_on_VGs (){# List all varied-on Volume Groupslsvg -o | sort -r}#################################################get_LV_info (){Listing 13.2 AIXsysconfig.ksh shell script listing.(continues)346 Chapter 13# List the Logical Volumes in each varied-on Volume Groupfor VG in $(get_varied_on_VGs)dolsvg -l $VGdone}#################################################get_paging_space (){# List the paging space definitions and usagelsps -aecho \nlsps -s}#################################################get_disk_info (){# List of all hdisk s (hard drives) on the systemlspv}#################################################get_VG_disk_info (){# List disks by Volume Group assignmentfor VG in $(get_varied_on_VGs)dolsvg -p $VGdone}#################################################get_HACMP_info (){# If the System is running HACMP then save the# HACMP configurationif [ -x /usr/sbin/cluster/utilities/cllsif ]then/usr/sbin/cluster/utilities/cllsifecho \n\nListing 13.2 AIXsysconfig.ksh shell script listing
[ Pobierz całość w formacie PDF ]