Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 09-14-2005, 12:24 AM   #1
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

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
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

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
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

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


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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:48 AM.

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