LinuxQuestions.org
Review your favorite Linux distribution.
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-14-2005, 12:24 AM   #1
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Rep: Reputation: 30
Shell scripting: Doing MySQL Dump base on date


i am doing regular mysqldump to backup databases daily.
the files are gzipped and store (via scp) into another server (let's call it server B)
filename format is
database_YYYY-mm-dd.sql.gzip

I want to write a shell script such that i can draw the data and at the same time, maintain only up to 7 days worth of data

I use $today=`date -I' to get the today's date format so can store in the file...

but to calculate today's date minus x no. of days?

hope its clear enough

Thanks mate!
 
Old 09-14-2005, 04:46 PM   #2
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 927

Rep: Reputation: 30
For today's date - x days, you can use the date command again (you're going to laugh ):

`date +'%Y-%m-%d' --date '7 days ago'`
 
Old 09-21-2005, 10:23 PM   #3
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
wah serious!!!! hahahaha!
 
  


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
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell interface vs shell scripting? I'm confused jcchenz Linux - Software 1 10-26-2005 03:32 PM
MySQL :: Restoring Dump Swakoo Linux - General 6 09-09-2005 01:27 AM
Mysql with 10.2 dump barrythai Mandriva 2 04-11-2005 07:18 PM
How do I get a dump file (.sql) into MySql? TreeDragon60 Linux - Software 4 03-21-2004 05:19 AM


All times are GMT -5. The time now is 06:35 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