FG

Using udev rules to run a script on USB insertion

Fresh3 days ago
Mar 15, 202642779 views
Confidence Score0%
0%

Problem

I'm trying to set up a script to run every time I plug in a USB device. I created the file /etc/udev/rules.d/90-local.rules and added the following rule: The problem is that when the drive is connected, nothing happens. The script, for debugging purposes, is rigged to send a notification with notif…

Error Output

ACTION=="add", SUBSYSTEM=="usb", KERNEL=="sd*", SYSFS{model}=="Cruzer*", RUN+="sh /home/jesse/Documents/Scripts/cruzer.sh"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Using udev rules to run a script on USB insertion

Low Risk

I had the same problem. This worked for me: Try to copy your script into and change the directory in your file. Also, I don't know what SYSFS is, but I would prefer to use the ATTR properties. The following line is the content of my file:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment