LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-26-2009, 11:43 PM   #1
chamreth
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
Lightbulb Using Shell Script crontab backup and delete with schedule


Dear,

I have a problem need help, I want to do a schedule with using shell script with crontab in linux SuSE SLES 10.
The problem as below:

1. I have many server that want to do backup mysql all from that server everyday. I need advice for for write shell script to backup all mysql in different server to server backup everyday and create auto folder as date example 27102009, 28102009..........for a month will has 30 folder in server backup.
2. Also need to write shell script to delete all folder but keep only one week last example from 1 to 30 it will has 30 folder in sever backup but i want to keep only 7 folder last and want to set schedule delete it every saturday night.
3. used that shell script with crontab in linux.

Any one has an idea pls advice me or sent me a mail If all above not clear can ask me for detail than this.


Thanks in advance!!

Last edited by chamreth; 10-27-2009 at 10:42 PM.
 
Old 10-27-2009, 12:34 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
1. show us what you've tried so far. Try these for shell coding:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

See also
http://dev.mysql.com/doc/refman/5.0/...-recovery.html
http://linux.die.net/man/1/rsync

2. don't post your email, we do our talking here, so all can see & benefit.
In addition, a spambot could come along and grab it and you'll be sorry.
 
Old 10-27-2009, 01:26 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
You could also use this tool for backing up your databases. See Here
 
Old 10-27-2009, 07:47 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Also, if you have a lot of servers, look at http://www.amanda.org/
 
Old 10-27-2009, 10:43 PM   #5
chamreth
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Could you give me a specific than this?
becas i young on using linux so i can't catch your point.

Regards,

Quote:
Originally Posted by chrism01 View Post
1. show us what you've tried so far. Try these for shell coding:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

See also
http://dev.mysql.com/doc/refman/5.0/...-recovery.html
http://linux.die.net/man/1/rsync

2. don't post your email, we do our talking here, so all can see & benefit.
In addition, a spambot could come along and grab it and you'll be sorry.
 
Old 10-27-2009, 11:10 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Try reading them, write some code and come back if you get stuck.
 
Old 10-28-2009, 12:10 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by chamreth View Post
Could you give me a specific than this?
becas i young on using linux so i can't catch your point.

Regards,
Have you gone through the my post#3? Its just a tool that you can configure with little knowledge of Linux. But some effort from your side is still needed.
 
Old 10-28-2009, 06:59 AM   #8
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,191

Rep: Reputation: 105Reputation: 105
Keyword: mysql. If your primary concern is backing up your MySQL databases, then ChrisM01 already gave you a link to the Backup and Recovery documentation at mysql.org, and Chaitanya already gave you a reference to phpMyBackupPro. I would also look at Zmanda Recovery Manager (ZRM) for MySQL. Both of those are open source. You can install them on your system and configure them to back up your MySQL databases according to your own choice of schedule.

You should also have a regular backup routine aside from MySQL. If you use ZRM, that will end up with disk based files that you could use to recover your databases. You can then use something like Amanda (already mentioned by ChrisM01) to back that up along with the rest of your system -- to tape, to virtual tapes, to off site systems (cloud backup), etc.

You can play with scripting these sorts of things yourself, and that can be a good learning process, but you will quickly grow out of that. There are just lots of open source projects out there that will do these things for you. They will take into account a lot more detail than you can manage to script for yourself.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 06:19 PM
Delete a lin from crontab using shell scripting srinivasj Programming 3 07-07-2009 11:46 PM
Crontab entry to schedule a script every 14 days senrooy Linux - General 12 06-03-2009 08:54 AM
Using crontab to schedule a script stuball Linux - Server 9 05-19-2009 07:39 AM
How to create/delete temp/backup files through a shell script ? Sid2007 Programming 4 10-17-2007 01:55 PM


All times are GMT -5. The time now is 02:17 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration