# dfchk Check current df against a base (in /u1/bin) bob Sept 30 98
# create a new df
#
# to regenerate the 'base (original) run the command
# df -k | awk '{print $5, "|", $6}' > /tmp/origdf
# *** be careful about using the /tmp directory for stuff that is not temporary....
# Mabe put it somewhere else.
#
df -k | awk '{print $5, "|", $6}' > /tmp/newdf
echo "Org Now Incr. File System" pr -mts"|" /tmp/origdf /tmp/newdf | grep -v capacity | awk -F"|" '{printf "%4s %4s %3s %s\n", $1, $3, substr($3,1,2) - substr($1,1,2), $4}'
=====================================================
/* ut/logchk bob Aug 1998 */
unix tail -500r liveappl.lg|pg -p"USE KEYS Enter - + or q_".
=========================================================
/* ut/syschk bob Aug 1998 */
unix silent proutil liveappl -C busy > /tmp/schktmp.
unix silent proutil livemenu -C busy >> /tmp/schktmp.
unix cat /tmp/schktmp | grep live; who -b; nwho; df -k /usr2 .
==========================================================
# summary of Unix users
who | cut -c1-8 | grep -v "users=" | sort | \
uniq -c | sort -r | pr -5 -t -a ;
echo "
Total User Lines: `who | wc -l `
Users: `who | cut -c1-8 | \
grep -v "users" | sort | uniq | wc -l ` "
This one I call "nwhop", 'caus it counts the Progress processes...
# Progress User count
echo " Progress (database) Process owners
"
ps -ef | cut -c1-8,49- | grep progres | grep -v grep | \
cut -c1-8 |sort | uniq -c | sort -r | pr -5 -t -a ; echo "
Total User Lines: `who | wc -l `
DB (Progress) Proceses: `ps -ef | grep progres | grep -v grep | wc -l`
"
============================================
# fpf search for a [partial] file
# syntax fpf <filenam> [subdir]
d=$PROPATH
for dir in ` echo $d | tr ":" " " `
do
echo " Searching $dir..."
find $dir/$2 -name "$1" -type f -exec ls -l {} \;| cut -c34-110
done
and to search for a particular string ...
================================================================
# fpstring find a string on a path (usually PROPATH) bob summer 1998
# syntax fpstring <findtext> [subdir]
# the subdir is optional, but if you only want to search the "op" then
# use that.
# if there is a space in the findtext then quote - std grep stuff
# Example: to find the programs that have "screenb" in the "op" then
# fpstring screenb op
# You may want to hardcode the "d" variable
#
d=$PROPATH
for dir in ` echo $d | tr ":" " " `
do
echo " Searching $dir..."
for fil in `find $dir/$2 -exec fgrep -li "$1" {} \;`
do
echo " ** Found in ------- $fil"
fgrep -i "$1" $fil
done
done
But first run this against the database:
proutil livedatabase -C tabanalys > /tmp/rc-cnt.
That gives a record count (in /tmp/rc-cnt), which I integrate into the output.
/* File, field and index review bob Feb 95 */
def stream qw .
def var cn# as int.
def var ex as char.
def var id# as int.
def var in# as int format "9".
def workfile fs# no-undo
field nam# as character format "x(33)"
field siz# as character format "x(33)" label "Fields"
field recs# as character format "x(33)" label "Records".
def var rec-cnt as character format "x(20)" label "Recs(diff)".
def stream out# .
def var com# as character format "x(77)".
def variable f-c as int..
output to /dev/null.
input from /tmp/rc-cnt .
repeat:
create fs#.
set nam# recs# siz#.
end.
input close.
output close.
create fs#. /* a blank */
assign nam# = "unknown"
siz# = "..."
recs# = "".
output to /tmp/fields.
for each _file where not _file-name begins "z_"
and not _file-name begins "_" no-lock:
find first fs# where fs#.nam# = _file-name no-lock no-error.
if not available fs# then find first fs# where fs#.nam# = "unknown" no-lock.
id# = 0.
for each _index of _file no-lock:
id# = id# + 1.
end.
display caps(_file-name) format "x(14)"
string(id#) + " " + recs# format "x(20)" with no-label.
for each _field of _file no-lock:
in# = 0.
for each _index-field of _field no-lock:
in# = in# + 1 . /*_index-seq */.
end.
if _extent = 0 then ex = "".
else ex = "[" + string(_extent) + "]".
display space in# when in# ne 0 space(0) _field-name format "x(14)"
space(0) "+" when _man space(0) _format + ex format "x(25)"
with no-label .
end. /* each field */
end. /* each file */
/* use this command to print the output in columns
on a laser printer
unix silent pr -6 -w180 -l62 -f /tmp/fields | lp -olpi=8 -ocpi=17 -ylandscape */
That was exciting... how about something similar for the indexes.
/* index formatting by bob chassels - all acknowledgment greatfully received
- no critism: 'cause I know that you could do it better */
/* remember that
"proutil livedatabase -C tabanalys > /tmp/rc-cnt" should be run. */
def workfile fs# no-undo
field nam# as character format "x(33)"
field siz# as character format "x(33)" label "Fields"
field recs# as character format "x(33)" label "Records".
def var in# as character format "x(60)" .
output to /dev/null.
input from /tmp/rc-cnt .
repeat:
create fs#.
set nam# recs# siz#.
end.
input close.
create fs#. /* a blank */
assign nam# = "unknown"
siz# = "..."
recs# = "".
output to /tmp/indexes.
for each _file no-lock:
find first fs# where fs#.nam# = _file-name no-lock no-error.
if not available fs# then find first fs# where fs#.nam# = "unknown" no-lock.
display caps(_file-name) format "x(15)"
recs# format "x(9)" label "Recs" with frame a side-label.
for each _index of _file no-lock:
for each _index-field of _index no-lock:
in# = "".
for each _field of _index-field no-lock:
in# = in# + /* string(_index-seq) + */ _field-name + ", ".
end.
end.
display "U" when _index._unique _index-name + ": " + in# format "x(78)" with frame b no-box.
end.
end.
/* the file /tmp/indexes can now be reviewed/printed using the pr command
as in the fields program: eg;
pr -3 -w180 -l62 -f /tmp/fields | lp -olpi=8 -ocpi=17 -ylandscape */