1

I've spent a lot more time than I was expecting and was hoping I could get some help debugging.

My goal is to sync files between my documents and my usb drive as soon as it is mounted.

I've consulted a lot of posts on this, but these two have been the most beneficial.

Autorun a script after I plugged or unplugged a USB device

How to run a script when a specific flash-drive is mounted?

My scripts work. I have executed them by hand, and they create log files which tell me they are running and performing the files I tell them to.

What I don't know if the rules from udev are executing the RUN command. Here's all the stuff.

typing usb reveals the following of the device of interest:

Bus 003 Device 015: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick

File: /etc/udev/rules.d/00-usb-kingston.rules

ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545"
ACTION=="add", RUN+="sh /home/holiestcow/.bin/usb-kingston-in_dev"

Typing udevadm rules /etc gives me the following:

parse_file: reading '/etc/udev/rules.d/00-usb-kingston.rules' as rules file

File: /home/holiestcow/.bin/usb-kingston-in_udev

#!/bin/bash
echo "in_udev" > progress.txt
/home/holiestcow/.bin/usb-kingston-in &

File: /home/holiestcow/.bin/usb

#!/bin/bash
sleep 1
DISPLAY=":0.0"
HOME=/home/holiestcow/
XAUTHORITY=$HOME/.Xauthority
export DISPLAY XAUTHORITY HOME

echo "kingston-in part dos" >> progress.txt
rsync -auv --delete -n /media/CARLO\ GEN/ /home/holiestcow/Documents/ >> progress.txt
rsync -auv --delete -n /home/holiestcow/Documents/ /media/CARLO\ GEN/ >> progress.txt

Future thanks for your help.

1 Answer 1

0

How to easily add scripted actions on various events

I know this is missing the "using udev"-part of your question, but you might still be interested.

Install cuttlefish Install banshee

I use it myself for automated-script when I connect to different WLan APs. It's dead-easy to setup. OMG-Ubuntu has an article on it.

2
  • Thank you so much. I'm pretty fed up with the udev route. I think this will do quite nicely.
    – user215920
    Nov 17, 2013 at 20:21
  • Can I beg you to accept my answer and to gratify my effort? Thanks :)
    – MadMike
    Nov 22, 2013 at 12:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .