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 --follow
as you connect your devices. There's a system, calledudev
that notices when device events happen. Readman udev
, andman -k udev
. – waltinator Jul 30 '23 at 22:53udev
rules (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 atudev
on your system, search forudev
tutorials on the web, ... Don't fall victim to UTBLT! (Using Tool Before Learning Tool). – waltinator Jul 31 '23 at 15:13