LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Bash Shell Script - Check SQL file for corruption (https://www.linuxquestions.org/questions/linux-general-1/bash-shell-script-check-sql-file-for-corruption-4175426892/)

RML1992 09-12-2012 10:08 AM

Bash Shell Script - Check SQL file for corruption
 
Does anyone know anyway of using a shell script, to use an if statement to check whether an SQL file is corrupt?

michaelk 09-12-2012 10:35 AM

And what database are we running?

RML1992 09-13-2012 05:16 AM

A MySQL Server. A script on another server creates a SQL dump and sends it to a backup server and then a script on the backup server drops the old database and imports it. But I would like to get the script to check whether the SQL dump is corrupt before dropping the old database. If you have any suggestions they would be much appreciated :).

chrism01 09-14-2012 12:47 AM

Take the hash of the file before transmission eg md5sum or sha256sum and compare after copy.
TBH though, if you use eg scp, I reckon that will ensure a clean copy, but no harm in checking if paranoid :)


All times are GMT -5. The time now is 08:11 PM.