LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-07-2008, 06:38 PM   #1
dadrummerray
LQ Newbie
 
Registered: Jan 2006
Posts: 2

Rep: Reputation: 0
Smile Samba and Tar question


Hello Everybody,

I have a Fedora* box running a webserver that i am trying to backup. I have done this on windows but i haven't done too much with linux to know what exactly i need to do.

Here is what i want to accomplish:
1) Create a crontab to run a file every day that will make a tar backup of my webserver folder (/var/www/html)
2) have that same crontab run a dump of my mysql database
3) have the same crontab tar those two files
4) have the same crontab copy the big tar to a backup server to be used for restore later if needed. The server is a windows file server

I have a file that will make backups of the databases and the webserver folder. I am having problems getting fedora core8 to send that tar file to the windows file server. Also, i would like to keep 5 days of backups in case of needing to restore to a previous day or something. This can be done through a rename and copy command (which i can do) but i will need to be mounted to the share in order for that to work. Can anyone offer any help?

Thanks!!
 
Old 04-07-2008, 06:50 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Code:
#!/bin/bash

cd /var
tar cf backup_dir/www_backup.tar www/html
mysqldump -uuser -ppass db_name > backup_dir/database_backup.sql
cd backup_dir
tar cvjpf backup.`date +%a`.tbz2 www_backup.tar database_backup.sql
cp backup.`date +%a`.tbz2 /windows/share
.. which will end up storing the last 7 days of backups & continuously overwrite anything older than 7 days. Why? because "date +%a" returns a weekday, so the backups will look like backup.Mon.tbz2

it also has the nice side effect of sending you a mail every time it's executed as that last tar is verbose & output from a cron script usually gets emailed to the owner. This is a good way of verifying everything worked.

The type of shell doesn't matter... could be bash, tcsh, sh, whatever you're most familiar with.

Last edited by BrianK; 04-07-2008 at 06:52 PM.
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM
Installing Samba from tar.gz file dhatcher2 Linux - Software 1 10-31-2004 12:19 AM


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