Skip to main content
Changed the udev names and fixed somes misatkes (ATTR -> ATTRS, and ProductID)
Source Link
Edelweiss
  • 111
  • 1
  • 1
  • 3

I have created a udev rules which is supposed to mount a USB device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

9510-usb_back.rules

into:

/etc/udev/rules.d/

(I used 95 because the backup script takes some seconds and I want to run it as late as I can for avoiding to delay other stuff)

And finally the rule itself:

ACTION=="add", SUBSYSTEM=="usb", ATTRATTRS{idVendor}=="054c", ATTR{idProduct}=="0234"=="0243", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTRATTRS{idVendor}=="054c", ATTR{idProduct}=="0234"=="0243", RUN+="/usr/local/bin/backup_database"

I have tried this too:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my USB device I got this weird message:

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write through

twice

But nothing happened. No USB device mounted, no data backed up.

I looked with tail -f /var/log/message

And the USB drive looks like detected:

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit: Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further information if needed, such as the script or more logs messages :)

I have created a udev rules which is supposed to mount a USB device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into:

/etc/udev/rules.d/

(I used 95 because the backup script takes some seconds and I want to run it as late as I can for avoiding to delay other stuff)

And finally the rule itself:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my USB device I got this weird message:

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write through

twice

But nothing happened. No USB device mounted, no data backed up.

I looked with tail -f /var/log/message

And the USB drive looks like detected:

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit: Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further information if needed, such as the script or more logs messages :)

I have created a udev rules which is supposed to mount a USB device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

10-usb_back.rules

into:

/etc/udev/rules.d/

(I used 95 because the backup script takes some seconds and I want to run it as late as I can for avoiding to delay other stuff)

And finally the rule itself:

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", ATTR{idProduct}=="0243", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", ATTR{idProduct}=="0243", RUN+="/usr/local/bin/backup_database"

I have tried this too:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my USB device I got this weird message:

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write through

twice

But nothing happened. No USB device mounted, no data backed up.

I looked with tail -f /var/log/message

And the USB drive looks like detected:

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit: Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further information if needed, such as the script or more logs messages :)

cleaned up text
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

I have created a udev rules which is supposed to mount a usbUSB device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

95-usb_back.rules

into:

/etc/udev/rules.d/

/etc/udev/rules.d/

(I used 95 because the backup script takes some secondesseconds and I want to run it as laterlate as I can for avoiding to delay other stuff)

And finally the rule itself  :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too  :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my usbUSB device I got athis weird message  :

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write throughtthrough

twice

But nothing happen, not usbhappened. No USB device mounted, no data backed up.

I looked with tail -f /var/log/message

And the USB drive looks like detected  :

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit  : Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further informationsinformation if needed, such as the script or more logs messages :)

I have created a udev rules which is supposed to mount a usb device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into

/etc/udev/rules.d/

(I used 95 because the backup script takes some secondes and I want to run it as later as I can for avoiding to delay other stuff)

And finally the rule itself  :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too  :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my usb device I got a weird message  :

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write throught

twice

But nothing happen, not usb device mounted, no data backed up

I looked with tail -f /var/log/message

And the USB drive looks like detected  :

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit  : Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further informations if needed, such as the script or more logs messages :)

I have created a udev rules which is supposed to mount a USB device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into:

/etc/udev/rules.d/

(I used 95 because the backup script takes some seconds and I want to run it as late as I can for avoiding to delay other stuff)

And finally the rule itself:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my USB device I got this weird message:

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write through

twice

But nothing happened. No USB device mounted, no data backed up.

I looked with tail -f /var/log/message

And the USB drive looks like detected:

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit: Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further information if needed, such as the script or more logs messages :)

Thanks, salutations and username (profile!) not necessary on SO/SX http://meta.stackoverflow.com/a/3021/186664
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

Good morning !

I have created a udev rules which is supposed to mount a usb device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into

/etc/udev/rules.d/

(I used 95 because the backup script takes some secondes and I want to run it as later as I can for avoiding to delay other stuff)

And finally the rule itself :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my usb device I got a weird message :

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write throught

twice

But nothing happen, not usb device mounted, no data backed up

I looked with tail -f /var/log/message

And the USB drive looks like detected :

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Thank you for helping !

Edit : Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further informations if needed, such as the script or more logs messages :)

Good morning !

I have created a udev rules which is supposed to mount a usb device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into

/etc/udev/rules.d/

(I used 95 because the backup script takes some secondes and I want to run it as later as I can for avoiding to delay other stuff)

And finally the rule itself :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my usb device I got a weird message :

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write throught

twice

But nothing happen, not usb device mounted, no data backed up

I looked with tail -f /var/log/message

And the USB drive looks like detected :

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Thank you for helping !

Edit : Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further informations if needed, such as the script or more logs messages :)

I have created a udev rules which is supposed to mount a usb device, backup some datas et cleanup everything. I am actually working on a Debian server.

There is the information about my usb device that I have with lsusb

Bus 001 Device 003: ID 054c:0243 Sony Corp. MicroVault Flash Drive

(Actually the lsusb returns more Bus / Device, but I have to write them by hand since I am not posting from my Debian machine :))

Then I have written my udev rule called :

95-usb_back.rules

into

/etc/udev/rules.d/

(I used 95 because the backup script takes some secondes and I want to run it as later as I can for avoiding to delay other stuff)

And finally the rule itself :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/mount_usb"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="/usr/local/bin/backup_database"

I have tried this too :

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0234", RUN+="bash /usr/local/bin/mount_usb"

Unsuccessfully :(

Then I restart udev

sudo /etc/init.d/udev restart

And when I plug my usb device I got a weird message :

[1348.295280] sd 6:0:0:0: [sdc] Assuming drive cache: write throught

twice

But nothing happen, not usb device mounted, no data backed up

I looked with tail -f /var/log/message

And the USB drive looks like detected :

usb 1-3: Product Storage Media 
usb 1-3 Manufacturer Sony`
...

Something must be wrong somewhere but I don't know what, neither where :(

Edit : Since I've been a little bit lazy because I can't rewrite everything from my server, please ask for further informations if needed, such as the script or more logs messages :)

edited tags
Link
Chris Down
  • 130.3k
  • 26
  • 277
  • 268
Loading
Source Link
Edelweiss
  • 111
  • 1
  • 1
  • 3
Loading