when this script runs every night at 9:00 the log file says that the usb harddrive was mounted at 9:00 and finished at 9:01 and the compare at 9:02 and the file is 2.6gb not really possible over a usb line. We orginally wrote to a 8gb usb stick which to 1 hour to write dir. and 30 min to compare. we switched to a 500gb harddrive and now everything claims to be done in 1 minute.
All file are correct on the harddrive, but for some reason it claims to have done it at incredible speed.
gair
#! /bin/sh
declare GEORGE
cd /
echo "start time" >> /var/log/usb.log
date >> /var/log/usb.log
GEORGE=$(head /WFCU/IMSWORKFILE)
echo $GEORGE >> /var/log/usb.log
mount /dev/sdb1 /media/usb
if [ $? = 0 ]
then
echo "file on usb" >> /var/log/usb.log
echo ls /media/usb/* >> /var/log/usb.log
mkdir /media/usb/$(date +%Y%m%d)
if [ $? = 0 ]
then
cp -rf /IMSHCS02/$GEORGE /media/usb/$(date +%Y%m%d)/
echo "file on usb after copy" >> /var/log/usb.log
echo ls /media/usb/* >> /var/log/usb.log
echo "end time" >> /var/log/usb.log
date >> /var/log/usb.log
diff -i -q --side-by-side --recursive /snapserver/$GEORGE /media/usb/$(date +%Y%m%d)/$GEORGE >> /var/log/usbcheck.log
umount /media/usb
echo "end compare time" >> /var/log/usb.log
date >> /var/log/usb.log
else
echo "1st attempt at making dir failed" >> /var/log/usb.log
mkdir /media/usb/$(date +%Y%m%d)
if [ $? = 0 ]
then
cp -rf /IMSHCS02/$GEORGE /media/usb/$(date +%Y%m%d)/
echo "file on usb after copy" >> /var/log/usb.log
echo ls /media/usb/* >> /var/log/usb.log
echo "end time" >> /var/log/usb.log
date >> /var/log/usb.log
diff -i -q --side-by-side --recursive /snapserver/$GEORGE /media/usb/$(date +%Y%m%d)/$GEORGE >> /var/log/usbcheck.log
umount /media/usb
echo "end comparetime" >> /var/log/usb.log
date >> /var/log/usb.log
else
echo "2nd attempt at making dir failed" >> /var/log/usb.log
umount /media/usb
fi
fi
else
echo "no usb stick" >> /var/log/usb.log
fi
Start Free Trial