title: How do I use udev to run a shell script when a USB device is removed?
body: <p>This is my rule:</p>
  
  <pre><code>ENV{DEVTYPE}=="usb_device", 
  ACTION=="remove", 
  SUBSYSTEM=="usb", 
  ATTR{idVendor}=="8829", 
  ATTR{idProduct}=="0010", 
  RUN+="/bin/mkdir /home/zkd/123"
  </code></pre>
  
  <p>It doesn't work. But this rule:</p>
  
  <pre><code>ENV{DEVTYPE}=="usb_device", 
  ACTION=="remove", 
  SUBSYSTEM=="usb", 
  RUN+="/bin/mkdir /home/zkd/123"
  </code></pre>
  
  <p>It works!! And this also works:</p>
  
  <pre><code>ENV{DEVTYPE}=="usb_device", 
  ACTION=="add", 
  SUBSYSTEM=="usb", 
  ATTR{idVendor}=="8829", 
  ATTR{idProduct}=="0010", 
  RUN+="/bin/mkdir /home/zkd/123"
  </code></pre>
  
  <p>So how do I use udev to run a shell script when a USB device is removed? I must recognize the USB device with idProduct and idVendor. Thank for your answer!</p>