Hi I wanted to write a script that ran whenever any device was plugged in. If found How to detect an USB device? for usb ports. And How can I run a script when the power supply is plugged-in or -out? for powersupply, for powersupply however only featured if it was plugged in and then contounsly preformed an action. I need a script to run once whenever something is plugged in. Is there anyway to do this?
Asked
Active
Viewed 119 times
sudo journalctl --followas you connect your devices. There's a system, calledudevthat notices when device events happen. Readman udev, andman -k udev. – waltinator Jul 30 '23 at 22:53udevrules (not scripts) for a remote system, with unknown hardware, is not something that's easy. I won't. It's up to you to learn aboutudev, look atudevon your system, search forudevtutorials on the web, ... Don't fall victim to UTBLT! (Using Tool Before Learning Tool). – waltinator Jul 31 '23 at 15:13