Skip to content

Instantly share code, notes, and snippets.

@Und3rf10w
Created September 11, 2018 16:04
Show Gist options
  • Select an option

  • Save Und3rf10w/90b1b6103e2c7bdb95197ecb0ea6aa2c to your computer and use it in GitHub Desktop.

Select an option

Save Und3rf10w/90b1b6103e2c7bdb95197ecb0ea6aa2c to your computer and use it in GitHub Desktop.
Udev Setup script to notify any changes to USB subsystem
# Udev rule in /etc/udev/rules.d/
ACTION=="add", RUN+="/usr/local/bin/udevnotify"
# In `crontab -e` use this entry, replacing $USER with your username:
* * * * * /home/$USER/.local/udevnotifycheck
#!/bin/bash
# Store me in /usr/local/bin
# Replace $USER with the user account you want to use
touch /dev/shm/usbmodified
chown $USER:$USER /dev/shm/usbmodified
#!/bin/bash
# Store me in ~/.local/udevnotifycheck
#!/bin/bash
if [ -f /dev/shm/usbmodified ]; then
# Put your pushover/notify command here
rm /dev/shm/usbmodified
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment