#!/bin/ksh ## ## SCRIPT: dfk_anyhost_bygui ## ## Where: in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea ## ########################################################################## ## PURPOSE: Shows the disk usage (in 1K blocks) in ## all file systems on any SGI host on the NNS network. ## ## A Tcl-Tk script presents a GUI that prompts for hostid. ## The entry field is initialized with the hostname of the ## SGI host on which this script is running. ########################################################################## ## CALLED BY: spacetools in $FEDIR/scripts ## ## and, perhaps someday, by ## feamain -> feautils.menu -> fileman.menu script ## in $FEDIR/scripts ########################################################################## ## A LESSON LEARNED THE HARD WAY (~1995): ## DO NOT USE 'gr_osview' for filesystem space display; does updates every ## few seconds instead of a one-time query. Reference: ## gr_osview -D/apps/nns_com/fea/scripts/grosview_parmfilesys ########################################################################## ## MAINTENANCE HISTORY: ## Written by: Blaise Montandon 14Oct99 Based on 'dfk' and 'dfk_main' ## Updated by: Blaise Montandon 14Oct99 ########################################################################## if test "$FEDIR" = "" then FEDIR=/apps/nns_com/fea export FEDIR fi ########################################################################## ## PROMPT FOR HOSTNAME. ########################################################################## WINTITLE="FileSysSizes_AnyHost" export WINTITLE WIN_INFO="Enter the name of an SGI host on the NNS network. This utility shows the disk usage (in 1K blocks) in the file systems of the specified host. This is especially helpful to check whether 'local' file systems on the host are full or nearly full. Note that you can do queries on multiple hosts and bring the report windows side-by-side for comparison." export WIN_INFO HOST_ID="`hostname`" export HOST_ID # HOST_ID=`$FEDIR/tkGUIs/enter_hostid.tk` HOST_ID=`$FEDIR/tkGUIs/enter_hostid_optmenu.tk` if test "$HOST_ID" = "" then exit fi ########################################################################## ## SET OUTPUT FILENAME, local if possible. ########################################################################## . $FEDIR/scripts/set_localoutlist ########################################################################## ## SET REPORT HEADING. ########################################################################## DATETIME=`date '+%Y %b %d %a %T%p %Z'` echo "\ ...........................$DATETIME.......................... DISK USAGE (in 1K blocks) IN FILE SYSTEMS ON HOST *** $HOST_ID *** (Shows LOCAL file systems and SOME of the REMOTE file systems, if any, that are mounted on this host from SGI file servers.) For accurate size data on REMOTE file systems, query the server hostid. Sorted by FileSystem Name. ------------------------------------------------------------------------------- FileSystem-Name & below that Name Kbytes is ${HOST_ID}-Device-partition (xfs) OR Server:Directory (nfs) %used Type allocated Used Avail. ----------------------------------- ----- ---- --------- -------- --------- " > $OUTLIST ########################################################################## ## MAKE .rhosts FILE FOR THE USER, if needed. ########################################################################## ## . $FEDIR/scripts/mak_rhosts ## DONE BELOW. ########################################################################## ########################################################################## ## GENERATE REPORT CONTENTS. (from Local or Remote host) ########################################################################## THISHOST=`hostname` if test "$HOST_ID" = "$THISHOST" then ## FOR TESTING: # set -x /usr/sbin/df -k | sed '1d' | /usr/bin/sort +6 -7 | /usr/bin/awk \ '{printf ("%-35s %4s %7s %9s %9s %9s\n%-25s \n\n", $7, $6, $2, $3, $4, $5, $1)}' >> $OUTLIST ## FOR TESTING: # set - else . $FEDIR/scripts/mak_rhosts ## FOR TESTING: # set -x rsh $HOST_ID /usr/sbin/df -k | sed '1d' | /usr/bin/sort +6 -7 | /usr/bin/awk \ '{printf ("%-35s %4s %7s %9s %9s %9s\n%-25s \n\n", $7, $6, $2, $3, $4, $5, $1)}' >> $OUTLIST ## FOR TESTING: # set - ########################################################### ## REMOVE .rhosts FILE FOR THE USER. (Commented; not used.) ########################################################### # . $FEDIR/scripts/mv_rhosts fi ########################################################################## ## ADD REPORT 'TRAILER'. ########################################################################## echo "\ ......................................................................... The output above is from script $0 which was run from host $THISHOST . Uses a command sequence like: df -k | sort +6 -7 | awk '{printf (\" a format \", \$7, \$6, \$2, \$3, \$4, \$5, \$1) }' which sorts by FileSystem Name. ......................................................................... " >> $OUTLIST ########################################################################## ## SHOW REPORT. ########################################################################## $FEDIR/scripts/shofil $OUTLIST