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, 10: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, 10:35 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
And what database are we running?
 
Old 09-13-2012, 05: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, 12:47 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
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 09:49 AM
how to check folder if it has files in it using Bash Shell script vincent.dang Linux - Newbie 7 08-05-2010 07: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 05:49 PM
Check if actions in bash shell script are performed well proNick Linux - Newbie 6 02-09-2009 07:25 PM
shell script - how to check file size noir911 Programming 3 01-24-2009 09:17 AM


All times are GMT -5. The time now is 03:17 AM.

Main Menu
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