LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-12-2012, 11:08 AM   #1
RML1992
LQ Newbie
 
Registered: Jun 2012
Posts: 16

Rep: Reputation: Disabled
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?
 
Old 09-12-2012, 11:35 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,152

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
And what database are we running?
 
Old 09-13-2012, 06:16 AM   #3
RML1992
LQ Newbie
 
Registered: Jun 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
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 .
 
Old 09-14-2012, 01:47 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash Shell Script to check if a string has only alphabets and digits. aswani Programming 8 08-16-2012 10:49 AM
how to check folder if it has files in it using Bash Shell script vincent.dang Linux - Newbie 7 08-05-2010 08:58 PM
[SOLVED] Bash shell script to check the if empty files are being created & start the process hussa1n Linux - General 8 06-29-2010 06:49 PM
Check if actions in bash shell script are performed well proNick Linux - Newbie 6 02-09-2009 08:25 PM
shell script - how to check file size noir911 Programming 3 01-24-2009 10:17 AM


All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration