Are you a spammer

Please note, that the first 3 posts you make, will need to be approved by a forum Administrator or Moderator before they are publicly viewable.
Each application to join this forum is checked at the Stop Forum Spam website. If the email or IP address appears there when checked, you will not be allowed to join this forum.
If you get past this check and post spam on this forum, your posts will be immediately deleted and your account inactivated.You will then be banned and your IP will be submitted to your ISP, notifying them of your spamming. So your spam links will only be seen for an hour or two at most. In other words, don't waste your time and ours.

This forum is for the use and enjoyment of the members and visitors looking to learn about and share information regarding the topics listed. It is not a free-for-all advertising venue. Your time would be better spent pursuing legitimate avenues of promoting your websites.

USB PenDrive Sync

The Ultimate Guide for the rest of us


USB PenDrive Sync

Postby LeadFingers » Tue Apr 29, 2008 5:42 pm

Copied from Beefeater & tgalati4 in the main Ubuntu forum

What we are doing here you could describe as an incremental backup,
only the changes in the files will be updated.

It's important to know that if you set it up to go hard drive -> memory stick and then change a file on the memory-stick and run the script, it will be overwritten with the file on the hard drive.

You could use -u in rsync to ignore files which are newer on the memory stick.
I guess it would be possible to run the script both ways with -u but still there are some limitations.
One step at the time.

To make it automatic we create an udev rule.
Plug in the memory-stick and look which device drive it's using (/dev/sdb, /dev/sdc ..)
Code: Select all
dmesg

Mine is on /dev/sdc

Check vendor and model
Code: Select all
udevinfo -q all -n /dev/sdc

For me it's:
model: DataTraveler 2.0
vendor: Kingston

Now we can create the udev rule.
Code: Select all
sudo vim /etc/udev/rules.d/10-local.rules

and paste this line but replace it with your vendor and model.
SUBSYSTEMS=="scsi", ATTRS{vendor}=="Kingston", ATTRS{model}=="DataTraveler 2.0", RUN+="/usr/bin/usbbackup %k"

Create /usr/bin/usbbackup
Code: Select all
sudo vim /usr/bin/usbbackup

and put whatever script you have in there.

Then
Code: Select all
sudo chmod a+x /usr/bin/usbbackup

So that's pretty much the basics. How you do it is up to you

_________________________________________________________________________

A simpler solution is to put the file autorun in the root directory of the flash disk.

Activate scripts in gnome-volume-properties.

Add execute permissions to autorun:
Code: Select all
sudo chmod +x autorun

Put your rsync script inside autorun.

Now every time you plug in your usbstick,
you will get a dialog that asks if you want to run the script.

Just added nautilus /media/disk to the script to also have a nautilus windows open displaying the flashdisk contents.
1st Box: Ultimate Edition 2.0 x64/ 1.8 x64
2nd Box: XP (dusty)
3rd Box: Stable Media box Ultimate Edition 1.8 x64 with XBMC

The Oxen are slow but the Earth is patient ~Chuen~
User avatar
LeadFingers
U.E. God
U.E. God
 
Posts: 1303
Joined: Fri Nov 23, 2007 1:46 am
Location: Salem Oregon
Age: 63
Operating System: Ultimate Edition 3.1 64 BIT

Return to Newbie's Corner

Who is online

Users browsing this forum: No registered users and 5 guests