1832344 Members
2448 Online
110041 Solutions
New Discussion

cksum scripts

 
SOLVED
Go to solution
RICK TAN JEE HOW_1
Occasional Contributor

cksum scripts

Hi scripting experts,

I would like to write a script that can do cksum of every files and subdirectories under a certain directory. After which, I would like to compare to output with a reference check sum and report any files which has a different checksum or any new files

Can anyone help !!
Thanks !!!
5 REPLIES 5
Chakravarthi
Trusted Contributor

Re: cksum scripts

for i in $i
do ls
echo $i
cksum $i
done
Chakravarthi
Trusted Contributor

Re: cksum scripts

for i in $i; do ls ; echo $i; cksum $i;done
Robin Wakefield
Honored Contributor
Solution

Re: cksum scripts

Hi,

================================
#!/usr/bin/ksh

dir=/directory_to_check

find $dir | xargs cksum > /tmp/cksum.out.new 2>/dev/null
sdiff /tmp/cksum.out.old /tmp/cksum.out.new | awk 'NF!=6{print}'
mv /tmp/cksum.out.new /tmp/cksum.out.old
================================

You could use the "comm" command if you don't like the output of sdiff.

Rgds, Robin
Systeemingenieurs Infoc
Valued Contributor

Re: cksum scripts

take a look at www.tripwire.org ; it's a gnu product that does the same.
A Life ? Cool ! Where can I download one of those from ?
RICK TAN JEE HOW_1
Occasional Contributor

Re: cksum scripts

Robin,

Thanks it's a great script !!

I was wondering how I can just display the files which show a different checksum and not every files in the directory.