Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Could some help to check out this script or any syntax red or command out. This script will check any files with (gz, GZ, zip or ZIP) extension if check any file failed then send out the email notify to whoever need it. Thanks
This will run on Autosys:
Command /usr/local/apps/XXX/prod/bin/Checkfiles.ksh WORK_DIR "FILENAME" DC_MAIL
#!/bin/kshWORK_DIR=$1
FILENAME=$2
DC_MAIL=$3DATE=`date +%m%d.%H:%M:%S`
LOGFILE=/usr/local/apps/common/prod/logs/CHECK_${FIELNAME}.${DATE}.log{
echo "################NEW LOG##############\n"
cd ${WORK_DIR}
ls ${FILENAME}
if (($? > 0));then
echo "ERROR: The gz file was not found!"
exit 10
fi
for DON in `ls $FILENAME`
do############################################
### GZ, gz, ZIP or zip then check here ###
############################################
####if [[ $TYPE = gz ]] || [[ $TYPE = GZ ]] || [[ $TYPE = zip ]] || [[ $TYPE = ZIP ]] ==> Not sure yet.
#####thenif [[ ${DON} = *.gz ]] || [[ ${DON} = *.zip ]] || [[ ${DON} = *.ZIP ]];then
echo "File has gz extension, moving on..."
else
exit 20fi
gunzip -t $DON
#unzip -t $DON
if (($? > 0));then
echo "ERROR: Gz file corruption failed! More information should be in this logfile!"
exit 20
fi
done} >> "${LOGFILE}"
###################################################################
### End of checking it and e-mail to whoever request it.
###################################################################cat $LOGFILE | mailx -s "Files received was corruption or bad on the server." ${DC_MAIL}
cd /usr/local/apps/common/prod/logs
find *.log -mtime +45 -exec rm -f "{}" \;
exit $?

![]() |
replace \ with \\ using b...
|
Linux WeatherBug applet a...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |