Corrupt files in microSD - How to know if files are damaged?
Few things you can try:

Use fsck to check and repair bad blocks How do I check bad sector on my android with ADB recovery mode?

(alternatively follow this guide for FAT formatted cards)
Obviously, both need root, you could also try to run it from a regular Linux box.

And finally, how to run scripts on boot and use logcat perhaps to view the results. I would think that Android already does this check automatically, but...