Go Back   Linux Forums by TotalPenguin! Get linux Help! > Linux > Tutorials, Guides and Tips

Tutorials, Guides and Tips Member submitted guides, tips, tricks and howtos.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-27-2007, 02:33 AM
Junior Member
 
Join Date: Aug 2007
Location: Home
Posts: 22
Onur is on a distinguished road
Smile Using Tar in linux to make a backup

Using Tar in linux to make a backup This is just a small example of how you can use the TAR application with linux to generate a powerfull backup script triggered by a cron.

You will need to create an archive , either using vi or touch.

For example in this case lets say our script is called backup

vi backup

This will create the archive and open the vi editor, to add content to the archive press the I key to insert and then check out at my example here:

#--------------------------------------
#Beggining of script
#--------------------------------------
# Lets say you want to remove an old backup on autobackups folder
rm /autobackups/mybackup*.*
# Now lets say you want to make the script sleep for 3 seconds
sleep 3

#Now you want to backup /home entirely into /autobackups using tar

tar -cvf /autobackups/home$(date +%y%m%d).tar /home

#---END---

Please notice that you are creating a tar archive with the whole content of /home and adding the date of the backup to the name of the archive. To execute this script, you need to save it , on VI press ESCAPE , then activate the CAPS LOCK and press the Z key 2 times. (zz)

You will need to give the archive execute permissions, use the following command: chmod a+x backup , basically to run the script just type ./backup considering you are on the same path of the archive. Easy does it
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-27-2008, 12:06 PM
Senior Member
 
Join Date: Jun 2008
Posts: 110
rumen is on a distinguished road
Default

Very helpful information when you want to make a backup, thanks for sharing!
Reply With Quote
  #3 (permalink)  
Old 06-27-2008, 12:38 PM
Tor Tor is offline
Senior Member
 
Join Date: Oct 2007
Posts: 364
Tor is on a distinguished road
Default

It would be a big tarball for the entire drive though.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup? Grub Linux General 3 11-19-2008 12:56 PM
Make my Server more secure Grub Linux Security 4 10-07-2007 02:23 PM
Why XSserver 1.4 won't make it into Ubuntu Gutsy kernel Linux News 0 08-22-2007 08:27 AM
P2V: How To Make a Physical Linux Box Into a Virtual Machine kernel Linux News 0 08-21-2007 07:30 AM


All times are GMT. The time now is 02:34 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.