Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to automate backup with rsync to an external hard disk. What I want to do is to execute this command automatically when external hard disk is plugged. I do not want to run it when other hard disk or flash drive is plugged in. Can some please point me in the right direction. I am using Ubuntu 12.10.

Here is the command which I am planning to use.

rsync -arLth --progress --exclude-from '/home/user1/.backupExclude' /home/user1 media/user1/T500Backup/

and here is my .backupExclude file

user1@SCAR:~$ tail ~/.backupExclude 
Dropbox
Movies
user1@SCAR:~$
share|improve this question
1  
You can do this with udev, i don't remember exactly how. –  Jonathan Tribouharet Dec 23 '12 at 0:55
    
Definitely check out udev. –  Linuxios Dec 23 '12 at 1:09
    
Actually, using udisks is a better abstraction for this, listen for events on system dbus. –  Keith Dec 23 '12 at 1:58
1  
Run udisksctl monitor to see what events you get and what info there is, such as drive number. –  Keith Dec 23 '12 at 2:50
    
@Keith: This is awesome. I can use ID or serial#. But how, that is the big question. Others mentioned udev. I am still trying to figure out how I can use it. –  NikhilRathod Dec 23 '12 at 3:38
show 2 more comments

migrated from stackoverflow.com Dec 23 '12 at 2:24

This question came from our site for professional and enthusiast programmers.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.