LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2011, 02:19 PM   #1
gaspower
LQ Newbie
 
Registered: Dec 2005
Posts: 10

Rep: Reputation: 0
Help With Incremental Backup


Hello,

Need a little help with a .bash file script. Current script below works fine when initiated and creates the backup files of site and database. Where I need help, is that each time I initiate a backup, I would like to have each saving incremented by date and time. This way if I have to go back to a specific time it is available.

Thanks JR

#!/bin/bash
tar -cvjf backup/site.tar.bz2 /home/virtual/site.com/var/www/html/ > /dev/null 2>&1
mysqldump -u site -ppass site > backup/site.sql
 
Old 09-21-2011, 03:03 PM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Check out the man page for the date command for formatting options, but here's an example:

Code:
#!/bin/bash
DATETIME=`/bin/date +\%Y-\%m-\%d-\%H.\%M.\%S`
tar -cvjf backup/site.$DATETIME.tar.bz2 /home/virtual/site.com/var/www/html/ > /dev/null 2>&1
mysqldump -u site -ppass site > backup/site.$DATETIME.sql
 
  


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
incremental backup mahmoud Linux - Newbie 3 11-28-2008 04:31 AM
Incremental backup Ammad Linux - Software 2 02-22-2008 03:41 PM
About incremental backup satimis Linux - Software 0 06-15-2006 04:01 AM
incremental backup .... redrobin77 Linux - Software 1 01-31-2006 05:29 AM
incremental backup reaky Linux - Software 3 03-10-2004 03:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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