LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2015, 03:26 PM   #1
adumith
Member
 
Registered: Feb 2013
Posts: 46

Rep: Reputation: Disabled
Question Making a DB Backup and send it to another server


Hello everyone;

At this time I need to make a sh script to make a db backup an send it to another server.

Thinking about this, I think I have to:
1.- Make a connection beetween the servers without password
2.- The scrip must to do:
a.- Make the mysqldump
b.- Put it in a gzip file
c.- Send througth scp the gzip file and ONLY when the copy has done the script have to delete the files that are 3 days old.

Could you help me with this?

Do you consider that is a good idea or you have a better one?

Thanks in advance.
 
Old 03-03-2015, 04:24 PM   #2
Kgeil
Member
 
Registered: Mar 2014
Posts: 37

Rep: Reputation: Disabled
This looks like a really appealing option: http://wiki.bacula.org/doku.php?id=a..._backups:mysql

I haven't tried it yet, but it's on my to-do list, about 2 weeks out.


HTH,

Kevin
 
Old 03-03-2015, 04:31 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
mysqldump -h <ip> -u<user> p<pass> <db_name> > /path/to/save/file.sql
tar -czf archive_name-$(date +%F).tar.gz /path/to/save/file.sql
for i in `seq 2 31` ; do rm archive_name-$(date +"%m%d%Y" --date="$i days ago") ; done
You should have a user granted perms in mysql just for this purpose or use an existing one (if 'user'@'host' value allows it.
I would NOT use 'user'@'%' like so many are inclined to do)

Other solutions may be more dialed in, I'm tired.
Shout if you need help.

References:
http://www.cyberciti.biz/tips/backup...using-ssh.html
http://bash.cyberciti.biz/backup/bac...base-server-2/

Last edited by Habitual; 03-03-2015 at 04:45 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
making a Multi tape backup wish to send email zimbot Linux - General 2 05-27-2011 11:11 AM
making autosricpt for logging and send them to windows using ftp vodka33us Linux - Server 4 12-18-2008 08:08 AM
Making a backup e-mail server - need help with re-delivery britsky Linux - General 1 04-25-2006 11:55 AM
making java applets send packets videoediting Programming 4 05-03-2005 01:48 PM
Server does'nt send mail until shutdown and LAN can't send or receive. Wolfy Linux - Networking 0 08-02-2004 07:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 AM.

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
Open Source Consulting | Domain Registration