Hi,
I modified the findlarge bash script to check our UV files to ensure they are
not 32bit and > 1.8gb - it is run via cron each day.
#!/bin/bash
#
# SCRIPT: findlarge
#
# AUTHOR: Randy Michael
#
# DATE: 11/30/2000
#
# REV: 1.0.A
#
# PURPOSE: This script is used to search for files that
# are larger than $1 Meg. Bytes. The search starts at
# the current directory that the user is in, `pwd`, and
# includes files in and below the user's current directory.
# The output is both displayed to the user and stored
# in a file for later review.
#
# REVISION LIST:
#
# DATE: 23/09/2009 - amended to run under bash C.L. YOUI
# 16/04/2009 - modified so only 'italerts receives messages when zero
large files found (C.L.)
#
# set -n # Uncomment to check syntax without ANY execution
# set -x # Uncomment to debug this script
############################################
function usage
{
/bin/echo -e "\\n***************************************"
/bin/echo -e "\\n\\nUSAGE: findlarge [Number_Of_Meg_Bytes] [optional email
address for alert]"
/bin/echo -e "\\nEXAMPLE: filelarge 5"
/bin/echo -e" \\n\\nWill Find Files Larger Than 5 Mb in, and Below, the Current
Directory..."
/bin/echo -e" \\n\\nEXITING...\\n"
/bin/echo -e "\\n***************************************"
exit
}
############################################
function cleanup
{
/bin/echo -e "\\n********************************************************"
/bin/echo -e "\\n\\nEXITING ON A TRAPPED SIGNAL..."
/bin/echo -e
"\\n\\n********************************************************\\n"
exit
}
############################################
# Set a trap to exit. REMEMBER - CANNOT TRAP ON kill -9 !!!!
trap 'cleanup' 1 2 3 15
############################################
# Check for the correct number of arguments and a number
# Greater than zero
if [ $# -lt 1 ]
then
usage
fi
if [ $1 -lt 1 ]
then
usage
fi
# check for supplied mail recipients
ITALERTS='[email protected]'
if [ -n "$2" ]
then
MAILTO="$2"
else
MAILTO=$ITALERTS
fi
############################################
# Define and initialize files and variables here...
THISHOST=`/bin/hostname` # Hostname of this machine
DATESTAMP=`/bin/date +"%h%d:%Y:%T"`
SEARCH_PATH=`/bin/pwd` # Top level directory to search
MEG_BYTES=$1 # Number of Mb for file size trigger
DATAFILE="/tmp/filesize_datafile.out" # Data storage file
>$DATAFILE # Initialize to a null file
OUTFILE="/tmp/largefiles.out" # Output user file
>$OUTFILE # Initialize to a null file
HOLDFILE="/tmp/temp_hold_file.out" # Temporary storage file
>$HOLDFILE # Initialize to a null file
############################################
# Prepare the output user file
/bin/echo -e "\\n\\nSearching for Files Larger Than ${MEG_BYTES}Mb starting in:"
/bin/echo -e "\\n==> $SEARCH_PATH"
/bin/echo -e "\\n\\nPlease Standby for the Search Results..."
/bin/echo -e "\\n\\nLarge Files Search Results:" >> $OUTFILE
/bin/echo -e "\\nHostname of Machine: $THISHOST" >> $OUTFILE
/bin/echo -e "\\nTop Level Directory of Search:" >> $OUTFILE
/bin/echo -e "\\n==> $SEARCH_PATH" >> $OUTFILE
/bin/echo -e "\\nDate/Time of Search: `date`" >> $OUTFILE
#/bin/echo -e "\\n\\nSearch Results Sorted by Time:" >> $OUTFILE
############################################
# Search for files > $MEG_BYTES starting at the $SEARCH_PATH
/usr/bin/find $SEARCH_PATH -type f -size +${MEG_BYTES}000000c \
-print > $HOLDFILE
# How many files were found?
NUMBER_OF_FILES=0
if [ -s $HOLDFILE ]
then
# NUMBER_OF_FILES=`/bin/cat $HOLDFILE | wc -l`
# /bin/echo -e "\\n\\nNumber of Files Found: ==> $NUMBER_OF_FILES\\n\\n" >>
$OUTFILE
# Append to the end of the Output File...
## C.L. YOUI /bin/ls -lt `/bin/cat $HOLDFILE` >> $OUTFILE
for FNAME in `/bin/cat $HOLDFILE`
do
FTYPE=`/usr/bin/od -t x4 -An -N4 $FNAME`
FTYPEBASE=`/usr/bin/expr substr $FTYPE 1 6`
case $FTYPEBASE in
acef01)
FTYPE="[ UV 32bit headers ]"
FDETS=`/bin/ls -la $FNAME`
/bin/echo -e "\\n$FTYPE $FDETS" >> $OUTFILE
NUMBER_OF_FILES=$(($NUMBER_OF_FILES + 1))
;;
acef02)
FTYPE="[ UV 64bit headers ]"
;;
*)
FTYPE="[ Non-UV file ]"
;;
esac
done
# ENDS C.L.
fi
/bin/cat $OUTFILE # Show the header information plus any content
if [ $NUMBER_OF_FILES -gt 0 ]
then
/bin/echo -e "\\n\\nNumber of Files Found: ==>
$NUMBER_OF_FILES\\n\\n" >> $OUTFILE
/bin/echo -e "\\n\\nNumber of Files Found: ==>
$NUMBER_OF_FILES\\n\\n"
/bin/echo -e "\\n\\nThese search results are stored in ==> $OUTFILE"
/bin/echo -e "\\n\\nSearch Complete...EXITING...\\n\\n\\n"
/bin/cat $OUTFILE | /usr/bin/nail -s "$NUMBER_OF_FILES files larger
than $1 megabytes on $THISHOST under $SEARCH_PATH" $MAILTO
else
/bin/echo -e "\\n\\nNo 32bit UV files were found in the search path that"
/bin/echo -e "are larger than ${MEG_BYTES}Mb\\n\\n"
/bin/echo -e "\\n\\nNo 32bit UV files were found in the search path
that" >> $OUTFILE
/bin/echo -e "are larger than ${MEG_BYTES}Mb\\n\\n" >> $OUTFILE
/bin/echo -e "\\nEXITING...\\n\\n"
/bin/cat $OUTFILE | /usr/bin/nail -s "NO 32bit files larger than $1
megabytes on $THISHOST under $SEARCH_PATH" $ITALERTS
fi
------------------------------------------------------------------------------------------------------------------------------------
Colin Lucas
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin Smith
Sent: Saturday, 7 November 2009 6:46 AM
To: U2 Users List
Subject: Re: [U2] File corrupt
I should also mention that the database is UniVerse version 10.
Kevin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin Smith
Sent: Friday, November 06, 2009 2:40 PM
To: [email protected]
Subject: [U2] File corrupt
When someone tries to create a STOCK transaction, the follow error is
given:
WARNING: Internal file corruption detected during file open!
File must be repaired, possible truncation.
hsize: 2048
bsize: 2048
fsize: 2147483647
Unable to open "STOCK" file.
UVFIXFILE gives me:
Warning: "/man1/FCMAN/STOCK/DATA.30" has been truncated.
Attempting to pad last group buffer.
/man1/FCMAN/STOCK/DATA.30: File too large
WRITE Error!
File modulus is greater than physical file.
Attempting to correct file modulus.
Invalid nextsplit ptr in header.
Attempting to correct nextsplit ptr.
WARNING: Internal file corruption detected during file open!
File must be repaired, possible truncation.
hsize: 2048
bsize: 2048
fsize: 2147483647
Warning: Unable to set GROUP LOCKS on /man1/FCMAN/STOCK.
Beginning TRACE of /man1/FCMAN/STOCK.
When I use UniAdmin, I don't even see the STOCK file there.
Any ideas or help would be appreciated.
Kevin Smith
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
This email message and any files transmitted with it are intended only for the
addressee(s) and contain information which may be privileged, confidential
and/or subject to copyright. Use, interference with, disclosure or reproduction
of this material by anyone other than the intended recipient(s) is unauthorised
and prohibited. If you are not the intended recipient, please immediately
notify the sender by return email and delete this message from your system.
Youi Pty Ltd respects your privacy. Our privacy policy can be accessed from our
web site http://www.youi.com.au.
No representation is made that this email or any attachments are free of
viruses. Virus scanning is recommended and is the responsibility of the
recipient. Youi Pty Ltd accepts no liability for any damage caused by any virus
transmitted by this email or for any loss or damage arising from the use of
this email or attachments.
Youi Pty Ltd is committed to responsible environmental management in carrying
out its operations. Please consider the environment before printing this email.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users