HardwareLogic

Go Back   HardwareLogic > Specific Hardware > Software & OSs
Home Forums Rules All AlbumsBlogs Donate Subscriptions Register Mark Forums Read vBExperience

Software & OSs Operating Systems, Anti-Virus, Utilities and Programs.

Reply
 
LinkBack Thread Tools
Old May 16th, 2007   #1
Its dark in here
Points: 7,905, Level: 1
Points: 7,905, Level: 1 Points: 7,905, Level: 1 Points: 7,905, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
yurimxpxman's Avatar
 
Join Date: Jun 2006
Location: /home/yurimxpxman
Posts: 1,693
Default differential backups script for Unix

After hearing a friend brag about his company's 1/4 million dollar differential versioning system, I did a search for differential backup tools for Unix so I could do the same thing at home with my code. After a few minutes, I found the rdiff-backup utility (you probably already have it; if not, check your package manager, or download it here). I then came up with this short script to make the job semi-automatic. So basically, this will backup your entire home directory to another partition without wasting space on duplicate files.

Note that this script was written for the BASH shell, so you'll have to change it a bit to get it to run with ash. Also, you'll want to change the path to your backup destination.

To use the script, paste the following code into a text editor and save it as /usr/bin/baxup. To run the script, just run the "baxup" command from anywhere you like, whether it's a terminal or a startup entry, etc. The file will need executable permissions to run; you can do so with the following command, assuming you're a sudo user:

Code:
sudo chmod +x /usr/bin/baxup
To restore the backup, use "baxup -r". This will restore a three day-old copy of your files to a directory named "old" on your desktop.

Code:
#!/bin/bash
# baxup - a shell script to semi-automate the process of backing up
# your home directory
# (c) 2007 Joshua David Williams, licensed under the GPL
# EULA: http://www.gnu.org/licenses/gpl.txt

# Change the value of this variable to the destination of the backup:
D="/media/JOSH/bak/"

if [[ $1 =~ "-r" ]]; then
 rdiff-backup -r 3D $D ~/Desktop/old

else if [[ $1 =~ "-h" ]]; then
  printf "Creates a differential backup. To restore, use the -r command argument.\n"

 else
  rdiff-backup --include ~/tmp/keep --exclude ~/tmp  ~/ $D
 fi
fi





Last edited by yurimxpxman; May 17th, 2007 at 08:28.
yurimxpxman is offline   Reply With Quote
Reply

  HardwareLogic > Specific Hardware > Software & OSs


Thread Tools

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP profile, locating and identi file or script? Tech Geek Deluxe Troubleshooting 3 November 13th, 2007 14:21
Gaim currently listening script for Amarok yurimxpxman Software & OSs 8 February 26th, 2007 15:31
PHP script Zambini Internet/Networking 24 November 16th, 2006 18:57


All times are GMT -8. The time now is 21:53.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
© HardwareLogic 2005 - 2008. All Rights Reserved


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47