maintain database script...

Hi there. i'm new user at here

I need help for this. I need to write a script that maintains a database of cryptographic checksums. In other words, I need this script to check the files checksum whether the files has been modified or not. But i got no idea where to start. Hope anyone here can guide me or provide an example related to my question. thanks :slight_smile:

So you want to baseline a set of files with a checksum and track changes to those files by checking against the checksums stored in the database?

Look at Afick and AIDE for examples to get you going.

no..i mean write a bourne shell script that can store checksums of file into flat file.then can match the file's checksum with the checksum stored in flat file

Conceptually, those two tools are accomplishing exactly what you described in your OP. So using those as examples, you should be able to adapt to a shell script.

i checked the afick and i found not really related
it using md5sum and in perl but i want use cksum in bourne shell..

i can't access aide website too

That's why I say adapt for shell. You are trying to accomplish the same end goal.

In your OP you asked for a place to start. That's where to start.

It sounds like you are waiting for someone to begin writing a script for you.

no..i didn't mean it to..
i just confusing how to start as i don't know the basic concept..
i try look around the script but not really get it

start with the command you want to use... this is "cksum" in your case. now you need to build the sum for one file... after that you've to check the next file... save the checksum to another flat file using ">>" maybe... start writing the first few lines of your script! you'll find a hell of a lot examples here or everywhere on the net.
if you're stuck and need help, just come back and ask...

i already implement that part..
but i've given some command lines that need to be included in script such as -a, -c, -f, -g, -x,etc and each command line got their use in the script.

---------- Post updated at 12:05 PM ---------- Previous update was at 10:06 AM ----------

and another thing.
how am i gonna match the checksum with database?
example, i already store checksum of file a into database..
then i need to match the checksum of a with checksum that stored inside database.
i try using comm command but not work...any idea?

---------- Post updated 09-07-09 at 02:13 AM ---------- Previous update was 09-06-09 at 12:05 PM ----------

i got anopther question

now i using case statement to handle getopt
but what i facing is eg.
case $i in
a) execute this
b) if a) never execute, then b) also wont execute codes

so how do i store the case a into variable then can bring it to case b?